#分组显示时,只有被分组的列数据有效,其余无效
SELECT testName '学科名称',
sum(score)'科目总分数',
count(score)'科目人数',
avg(score)'科目平均成绩',
max(score)'科目最高分',
min(score)'科目最低分'#最后一个列数据不写【,】
from result
where studentId<5#具体的列信息筛选使用where
group by testName;#分组
having avg (score)>70#聚合数据筛选必须使用having
order by avg (score) desc;#order by一定在后方,最后方是limit
聚合函数的使用
最新推荐文章于 2024-08-06 15:31:28 发布