No cache version.

Caching disabled. Default setting for this page:enabled (code DEF204)
If the display is too slow, you can disable the user mode to view the cached version.

Rechercher dans le manuel MySQL

3.3.4.1 Selecting All Data

The simplest form of SELECT retrieves everything from a table:

  1. mysql> SELECT * FROM pet;
  2. +----------+--------+---------+------+------------+------------+
  3. | name     | owner  | species | sex  | birth      | death      |
  4. +----------+--------+---------+------+------------+------------+
  5. | Fluffy   | Harold | cat     | f    | 1993-02-04 | NULL       |
  6. | Claws    | Gwen   | cat     | m    | 1994-03-17 | NULL       |
  7. | Buffy    | Harold | dog     | f    | 1989-05-13 | NULL       |
  8. | Fang     | Benny  | dog     | m    | 1990-08-27 | NULL       |
  9. | Bowser   | Diane  | dog     | m    | 1979-08-31 | 1995-07-29 |
  10. | Chirpy   | Gwen   | bird    | f    | 1998-09-11 | NULL       |
  11. | Whistler | Gwen   | bird    | NULL | 1997-12-09 | NULL       |
  12. | Slim     | Benny  | snake   | m    | 1996-04-29 | NULL       |
  13. | Puffball | Diane  | hamster | f    | 1999-03-30 | NULL       |
  14. +----------+--------+---------+------+------------+------------+

This form of SELECT is useful if you want to review your entire table, for example, after you've just loaded it with your initial data set. For example, you may happen to think that the birth date for Bowser doesn't seem quite right. Consulting your original pedigree papers, you find that the correct birth year should be 1989, not 1979.

There are at least two ways to fix this:

  • Edit the file pet.txt to correct the error, then empty the table and reload it using DELETE and LOAD DATA:

    1. mysql> DELETE FROM pet;
    2. mysql> LOAD DATA LOCAL INFILE 'pet.txt' INTO TABLE pet;

    However, if you do this, you must also re-enter the record for Puffball.

  • Fix only the erroneous record with an UPDATE statement:

    1. mysql> UPDATE pet SET birth = '1989-08-31' WHERE name = 'Bowser';

    The UPDATE changes only the record in question and does not require you to reload the table.


Find a PHP function

Document created the 26/06/2006, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/mysql-rf-selecting-all.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.

References

  1. View the html document Language of the document:en Manuel MySQL : https://dev.mysql.com/

These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.

Contents Haut