mysql分组函数的特点-成都快上网建站

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://kswjz.com/article/gjejcs.html
扫二维码与项目经理沟通

我们在微信上24小时期待你的声音

解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流