1 2 --求最高分 3 select MAX(fMath) as 数学成绩最高分 from MyStudent 4 --求最低分 5 select MIN(fMath) as 数学成绩最低分 from MyStudnet 6 --求总分 7 select SUM(fmath) as 总分 from MyStudent 8 --求平均分,对空值不处理 9 select AVG(fmath) as 平均分 from MyStudnet 10 --求班级总人数,对空值不考虑 11 select COUNT(*) as 班级总人数 from MyStudent 12 --错误,因为聚合函数是把多条汇总成了一条,而fname则是查询出了多条,无法一一匹配 13 select fname,MAX(fMath) as 数学成绩最高分 from MyStudent 14 15 --聚合函数查询出的数据汇聚到一行 16 select 17 最高分=(select MAX(fMath) as 数学成绩最高分 from MyStudent), 18 最低分=(select MIN(fMath) as 数学成绩最低分 from MyStudnet) 19