成都创新互联网站制作重庆分公司

mysql分组函数的特点

#能排序就能比较,并且忽略了null值
SELECT MAX(last_name),MIN(last_name),COUNT(last_name) FROM employees;
#count只能计算不为null的个数
SELECT COUNT(commission_pct) FROM employees;
#忽略了null值
SELECT SUM(commission_pct),AVG(commission_pct) FROM employees;

#与去重连用

SELECT SUM(DISTINCT salary),SUM(salary) FROM employees;#distinct去重
SELECT COUNT(DISTINCT salary) ,COUNT(salary) FROM employees;

文章标题:mysql分组函数的特点
分享地址:http://cxhlcq.com/article/gjejcs.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部