# 常用的5个聚合函数 count(x)计数器,max(x)最大值min(x)最小值,avg(x)平均数,sum(x)求和
select count(*) from student where pwd is not null;
select max(age) '最大年龄',min(age)'最小年龄' from student;
select avg(age)'平均年龄' from student;
select sum(age)'年龄总和' from student;
select avg(age) '平均年龄',sum(age)/(select count(*) from student) 'sum的平均年龄' from student;
常用的5个聚合函数 count(x)计数器,max(x)最大值min(x)最小值,avg(x)平均数,sum(x)求和
最新推荐文章于 2024-07-12 16:55:56 发布