ORDER BY :根据字段名分组,升序降序
-
select * from table_name ORDER BY 字段名 [ASC|DESC]
having子句:与group by子句一起使用; 它将条件作用在GROUP BY子句创建的组上
-
#以age分组,每组最大salary最大的 salary select max(salary) from customers group by age having max(salary) > 20000
limit 限制展示
-
select * from 表名 order by 字段名 limit 数值
offset:偏移量 从某个值开始
-
select * from 表名 order by 字段名 limit 数值 offset 偏移量数值;
union:联合查询
-
query1 union query2;
distinct:去重查询 distinct运算符用于通过删除重复值来获取唯一值。
-
select distinct 去重字段1,去重字段2,...,去重字段n from 表名;