Databases & SQL
GROUP BY
Buckets rows into groups so aggregate functions can summarise each group separately.
Reviewed by the RadarTrek editorial team · June 2026
GROUP BY sorts rows into groups that share the same value in a column, then lets you run aggregate functions like COUNT, SUM, or AVG on each group independently — for example, total revenue per subscription plan, or signups per day.
Why it matters
- —GROUP BY plus an aggregate function is how almost every analytics dashboard is built.
- —HAVING filters groups after aggregation, the same way WHERE filters rows before it.
- —Forgetting to GROUP BY all non-aggregated columns is one of the most common SQL errors.
Where to learn this
🎓
GROUP BY: Summarising by Category
SQL for Builders course
This is the exact lesson that covers this term in depth — with examples, diagrams, and a hands-on exercise.