1)聚合函数:
1.count——返回找到的记录数;
2.min——返回一个数字列或计算列的最小值;
3.max——返回一个数字列或计算列的最大值;
4.sum——返回一个数字列或计算列的综合;
5.avg——对一个数字列或计算列求平均值;
select max(score) from score;
2)分组函数:group by
select sex from student group by sex;
3)分组函数一般和聚合函数连用
先分组再聚合,
select sex, max(score) from student order by sex;
如果聚合函数查询中, 所选择的列如果不在聚合函数里, 那就必须在group by之后, 否则就会报错。