Databases
📊 Aggregations: GROUP BY and HAVING
Summarize data with aggregate functions (COUNT, SUM, AVG, MIN, MAX), group it with GROUP BY, and filter groups with HAVING.
What you'll learn
- Summarize many rows into a single value with
COUNT,SUM,AVG,MIN, andMAX - Group rows with
GROUP BYand compute one aggregate per group - Filter groups with
HAVINGand tell it apart fromWHERE - Sort results by an aggregated value with
ORDER BY
Lessons
Aggregate functionsCOUNT, SUM, AVG, MIN, and MAX to summarize many rows into a single value. Grouping with GROUP BYCompute one aggregate per group, not for the whole table. Filtering groups with HAVINGWHERE filters rows; HAVING filters groups by their aggregate.Practice this module in the app
DevPath is a hands-on course: you read the theory here; in the app you put it into practice with exercises that really run, offline.
Start free in the app →