#常用的五个聚合函数 count(X)计数器,max(X)最大值min(x)最小值,avg(x)平均数,sum(X)求和
select count (*)from student where pwd is not null;
#max 与min select max (age )'最大年龄',min (age)'最小年龄'from student ;
#平均年龄
select avg (age)'平均年龄'from student ;
#年龄总和
select sum(age)'年龄总和' from student;
#利用sum计算平均数
select avg (age)'平均年龄',sum(age)/(select count (*)from student )'sum的平均年龄'from student;
聚合函数1
最新推荐文章于 2024-08-15 11:29:03 发布