mysql聚合函数

常用的聚合函数有:

平均值:avg()

取个数:count()

取总和:sum()

取最大值:max()

取最小值:min()

用法:select  聚合函数 from 表名 group by 字段名;

例如:

select * from student;

select count(ssex) from student group by ssex;

select count(ssex) as a from student group by ssex having a>3;

原文地址:https://www.cnblogs.com/wfc139/p/8954874.html