1 --聚合函数 2 -- sum() 3 -- 求和 4 select sum(age) from student; 5 6 -- count() 7 -- 求数量 8 -- 数据量 9 select count(*) as '数量' from student; 10 11 -- max() 12 --最大值 13 select max(age) as '最大值' from student; 14 15 -- min 16 -- 最小值 17 select min(age) as '最小值' from student; 18 19 -- avg() 20 --求平均值 21 select avg(age) as '平均值' from student; 22 23 --round() 24 --保留几位小数 25 select round(avg(age),2) as '平均值2位小数' from student; 26 27 -- 综合查询 28 select sum(age)/count(age) as '平均值' from student;