[英]what are aggregated columns in mysql?
What are aggregated columns and non-aggregated columns? 什么是聚合列和非聚合列? I have read the MySQL Handling of
GROUP BY
and am confused. 我已经阅读了
GROUP BY
的MySQL处理并且很困惑。 I do not know what 'aggregated columns' mean. 我不知道'聚合列'是什么意思。 Does anybody know?
有人知道吗?
Functions like SUM
, AVG
, MAX
, MIN
, COUNT
calculate data over a group of records and return aggregated results. SUM
, AVG
, MAX
, MIN
, COUNT
等函数计算一组记录中的数据并返回聚合结果。
Eg 例如
SELECT SUM(`salary`) FROM `employees`;
Returns 1 row with the total salary when 返回1行时的总薪水
SELECT `salary` FROM `employees`;
Returns multiple rows with the salary per employee. 返回多个行,每个员工的工资。
Lets say you want the average salary per gender: 让我们说你想要每性别的平均工资:
SELECT `gender`, AVG(`salary`) FROM `employees` GROUP BY `gender`;
Query 1 & 3 contain aggregated columns: SUM(`salary`)
AND AVG(`salary`)
查询1和3包含聚合列:
SUM(`salary`)
和AVG(`salary`)
SUM
, AVG
, COUNT
, MIN
, MAX
etc all are aggregate functions which create a column as a result of combining multiple rows. SUM
, AVG
, COUNT
, MIN
, MAX
等都是聚合函数 ,它们通过组合多行来创建列。
Aggregated columns are columns returned as a result of applying aggregate function ( SUM
, AVG
, COUNT
, MIN
, MAX
) 聚合列是应用聚合函数(
SUM
, AVG
, COUNT
, MIN
, MAX
)返回的列
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.