Aggregation
一句话解释
Aggregation 是处理的 computing 单个 summary 值从 许多行 using 函数如 COUNT, SUM, AVG, MIN, MAX.
用大白话说
Aggregation means summarizing many rows into a single value. SQL provides aggregate functions for this:
COUNT()— number of rowsSUM()— total of a numeric columnAVG()— average of a numeric columnMIN()/MAX()— smallest / largest value
For example, SELECT COUNT(*) FROM 顺序 gives the total number of orders. SELECT AVG(总计) FROM 顺序 gives the average order value.
When combined with GROUP BY, aggregation computes separate summaries for each group — for example, the average order value per user.
示例
sql
-- Total number of orders and average value
SELECT COUNT(*) AS total_orders,
AVG(total) AS avg_order_value
FROM orders;Two aggregate 函数 compute 单个 summary 行从 所有顺序.
相关术语
相关资源
相关课程
- Aggregations
学习 aggregate 函数.
解读错误信息
用大白话解释常见错误——什么意思、为什么发生、如何修复。