Data Wrangling & Pipelines
Group-by Aggregation
Group-by aggregation splits rows into groups by some column, then computes a single summary number per group — like average sales per region or count of orders per customer. The output has one row per group.
It is the engine behind almost every summary table and dashboard metric. The key mental model is split-then-summarize: choose the grouping column carefully, since grouping by the wrong thing answers the wrong question, and remember the result is a smaller table with one row per distinct group value.
GROUP BY region with AVG(sales) turns thousands of order rows into one average per region.
Also called