-- 按照年级分类汇总
select stu_grade '年级',count(*) as '记录数',max(stu_fee) '最高分',min(stu_fee) '高低分',avg(stu_fee) '平均分' from stu_info group by stu_grade;
-- 按照年级、班级分类汇总,并按最高分降序排序
select stu_grade '年级',stu_class '班级',count(*) as '记录数',max(stu_fee) '最高分',min(stu_fee) '高低分',avg(stu_fee) '平均分' from stu_info group by stu_grade,stu_class order by '最高分' desc;
select * from stu_info;