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;

posted @ 2019-01-12 16:33  OH-MY-GOD  阅读(190)  评论(0编辑  收藏  举报