Aggregation
In one line
Aggregation is the process of computing a single summary value from many rows using functions like COUNT, SUM, AVG, MIN, MAX.
In simple words
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 orders gives the total number of orders. SELECT AVG(total) FROM orders 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.
Example
sql
-- Total number of orders and average value
SELECT COUNT(*) AS total_orders,
AVG(total) AS avg_order_value
FROM orders;Two aggregate functions compute a single summary row from all the orders.
Related terms
Related Resources
Related Lessons
- Aggregations
Learn aggregate functions.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.