-
个常用的聚合函数 count(x)计数的max(x)min(x)最大值 最小值 avg(x)求平均数 sum(x)求和
-
#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 studemt)'sum计算平均年龄' from student; #MySQL聚合函数的使用方法