single-table query 1, query all:
SELECT * from table name;
2. Query the selected field data:
Select field name from table name;
3, query the data under the specified conditions:
Select field name from table name where condition (example id>3);
4, after the query for the field alias as:
Select formerly named as renamed from table name;
5, fuzzy query like:
Select *from table name where field name like one of the characters in the field (example ' small% ', then query out all the data in the field that begins with the fine print, '% percent sign stands for more than one ', ' _ Underline represents a ')
6. Sort ORDER BY:
SELECT * FROM table name order by field name; (Default ascending: ASC)
SELECT * FROM table name order by field name Desc; (Descending: DESC)
7. Limit the number of displayed data:
SELECT * FROM table name order BY field name limit 2;# Take two data in ascending field name, 2 limit two data
SELECT * FROM table name order BY field name limit 2, 2;
MySQL Single table query