码迷,mamicode.com
首页 > 数据库 > 详细

mysql聚合函数

时间:2019-01-12 18:00:20      阅读:166      评论:0      收藏:0      [点我收藏+]

标签:技术分享   rom   jpg   .com   sel   分享   info   sql   max   

常用的聚合函数有:

平均值: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;

技术分享图片

mysql聚合函数

标签:技术分享   rom   jpg   .com   sel   分享   info   sql   max   

原文地址:https://www.cnblogs.com/lsqbk/p/10260199.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!