MYSQL基础----ORDER BY关键字 / GROUP BY关键字/ GROUP_CONCAT()函数 / COUNT()函数 / HAVING 关键字 / WITH ROLLUP关键字 / LIMIT关键字
『1』对查询结果进行排序(默认是按照Asc排序方式排序)
select * from employee order by age;
『2』对查询结果进行Eesc排序
select * from employee order by age desc;
『3』多次排序
select * from employee order by d_id asc,age asc;
『4』order by和group_concat函数连用
select sex,group_concat(name) from employee group by sex;
『5』GROUP BY 关键字与COUNT()函数连用
select sex,count(sex) from employee group by sex;
『6』GROUP BY关键与HAVING一起使用
select sex,count(sex) from employee group by sex having count(sex)>=3;
『7』GROUP BY 关键字与WITH ROLLUP一起使用
select sex,count(sex) from employee group by sex with rollup; (在输出最后一行做数据统计)
『8』LIMIT关键字
select * from employee limit 0,3;(从0开始一共3行)