select class from xuesheng group by class
select class,AVG(chinese)from xuesheng group by class
select math from xuesheng where math >80 group by math
select math from xuesheng where math between 80 and 90 group by math
select math,count(*) from xuesheng where math between 80 and 90 group by math
选出语文成绩>80的班级行总数,按班级分组
select class,COUNT(*)from xuesheng where chinese>80 group by class
having 后面只能加聚合函数(从表中选出where后,先看前面的聚合函数,再算后面的聚合函数)
select class,COUNT(*)from xuesheng where chinese>=80 group by class having COUNT(*)>10
select class,COUNT(*),AVG(math)from xuesheng group by class having AVG(math)>90
select class,COUNT(*) from xuesheng where math>80 group by class order by COUNT(*)
--分别求每个班语数外最高分,并按语文升序排序
select class,MAX(chinese),MAX(math),MAX(english) from xuesheng group by class order by MAX(chinese)