The basic format of SQL statements:
select list of attributes from table [where conditional expressions 1]
[Group by attribute name [Having Conditional Expression 2]]
[Order by property name [ASC | DESC]]
1, sub-queries in the
[Not] in (element 1, element 2 ......);
2, with a range between and queries
[Not] between the value 1 and value 2
3, with like configuration wildcard query
[Not] like 'string'
Tsuhaifu:
(1)%: represents 0 or an arbitrary length string.
(2) _: only represent a single character.
4, null inquiry
is [not] null
5, band and multi-criteria query
The conditional expression 1 and conditional expression 2
6, or with multi-criteria query
The conditional expression 1 or conditional expression 2
7, to re-query
select distinct attribute name from the table name;
8, to sort the results
order by property name ASC | DESC;
ASC: ASC
DESC: descending
The default ascending order (ASC)
9, grouping query
group by property name [having conditional expression]
(* Questions) distinct and group by different?
10, limit paging query
limit transactions; // only one parameter, this means that no starting position is limit data
limit data 1 (starting position) data 2 (offset); // there are two parameters, the first one for the start position, the second represents the offset