千家信息网

mysql 分组函数的特点

发表于:2025-01-20 作者:千家信息网编辑
千家信息网最后更新 2025年01月20日,#能排序就能比较,并且忽略了null值SELECT MAX(last_name),MIN(last_name),COUNT(last_name) FROM employees;#count只能计算不为
千家信息网最后更新 2025年01月20日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;
0