1. Querying data
Select Property List
From table name and view list
[Where Condition expression 1]
[Group By property name 1 [having conditional expression 2] [with rollup the last record is the sum of the above Records]]//The field specified by the attribute name 1 is grouped, there is having to satisfy the conditional expression 2
[Order BY property name 2 [Asc|desc]]
where query condition:
Compare =, <, <=, >, >=,! =, <>,!>,!<
Specify the range between and, not between and
Specifies the collection in, not in
Match characters like, don't like <%: represents any length string, _: Represents a single character >
Null value is NULL, is not NULL
Eg:select * from test0 where ID in (1001,1004,1005);
SELECT * from test0 where ID between 1002 and 1005;
SELECT * FROM test0 where ID < 1004 and name like ' H_h_ '; Two conditions are met
SELECT * FROM test0 where ID < 1004 or name like ' h% '; Meet one of them to
Select distinct name from Test0; Query results are not duplicated
Select Id,group_concat (name) from the Test0 group by name;//displays the specified field values in the name group
Select Name,count (name) from the TEST0 group by name;//counts the number of records in each group of name groupings
Select Name,count (name) from TEST0 group by name has count (name) > 1; Shows the number of records greater than 1
A having expression is a record that acts on a group, and where acts on a table or view.
Select Name,count (name) from TEST0 group by name with rollup;
SELECT * from Test0 limit 3; Show only 3 records
SELECT * from Test0 limit 1, 3; Showing 3 records from 2nd record
MySQL Basic Operation-sql Query statement