聚合函数
求总和
select sum(列1) from表名;
求总数
select count(列1) from 表名;
最小值
select min(列1) from 表名;
最大值
select max(列1) from 表名;
求部分人数
select count(列1) from 表名 where 条件;
求平均值
select avg(列1) from 表名;
分组
group by
select 分组依据列,其它 from 表名 group by 分组的依据列
进阶
select 分组依据列,其它 from 表名 group by 分组的依据列 having 小组条件
多列分组
group by 分组依据列1,分组依据列n