常用聚合函数
SELECT MAX(t.salary) AS 最大值,
MIN(t.salary) AS 最小值,
AVG(t.salary) AS 平均值,
SUM(t.salary) AS 和值,
COUNT(t.salary) AS 计数,
STDDEV(t.salary) AS 标准差,
VARIANCE(t.salary) AS 方差
FROM temp t;
其中count
可以配合having来排查重复数据,例如:
SELECT t.department, COUNT(1)
FROM temp t
GROUP BY t.department
HAVING COUNT(1) > 1;
本文链接:
/archives/4repfrv3
版权声明:
本站所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自
ZFS的成长之路!
喜欢就支持一下吧