#聚合函数5个,数量count(x),最大值max(x),最小值min(x),平均数avg(x),求和sum(x)
select count(*) '所有成年人数量' from student where age>=18;
select max(age) '最大年龄',min(age) '最小年龄' from student;
select avg(age) '平均年龄' from student;
select sum(age) '总年龄' from student;
select avg(age) 'avg出的总年龄',sum(age)/(select count(*) from student) '计算出的' from student;
聚合函数
最新推荐文章于 2024-09-04 13:58:18 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)