In the "Create Database and database table with MySQL" article, how do we create a database and database table and how to add records to the database table. How can we retrieve data from database tables? 1. retrieving information from the database table. In fact, we have used the SELECT statement to retrieve information from the database table. Sel
In the "Create Database and database table with MySQL" article, how do we create a database and database table, and how to add records to the data database table. How can we retrieve data from database tables? 1. retrieving information from the database table. In fact, we have used the SELECT statement to retrieve information from the database table. Sel
In the "Create Database and database table with MySQL" article, how do we create a database and database table, and how to add records to the data database table. How can we retrieve data from database tables?
1. Retrieve Information from a database table
In fact, we have used the SELECT statement to retrieve information from database tables.
The select statement format is generally:
SELECT search keyword FROM the retrieved table WHERE search condition (optional)
The previously used "*" indicates Selecting All columns. Next we will continue to use the mytable table created in the previous article.
2. query all data:
Mysql> select * from mytable;
+ ---------- + ------ + ------------ + ---------- +
| Name | sex | birth | birthaddr |
+ ---------- + ------ + ------------ + -------- +
| Abccs | f | 1977-07-07 | china |
| Mary | f | 1978-12-12 | usa |
| Tom | m | 1970-09-02 | usa |
+ ---------- + ------ + ------------ + ---------- +
3 row in set (0.00 sec)
3. Corrected error records:
If the birth date of tom is incorrect, it should be, you can use the update statement to correct it: mysql> update mytable set birth = "1973-09-02" where name = "tom "; use the statement in step 2 to check whether it has been corrected.
,