7. Grouping and Filtering
This module teaches you how to summarize datasets and filter aggregate results without breaking query correctness.
Decision Guide
| Goal | Clause to use | Why |
|---|---|---|
| Group rows by one or more keys | GROUP BY | Produces aggregate result sets |
| Filter rows before grouping | WHERE | Reduces input rows early |
| Filter grouped results | HAVING | Applies conditions after aggregation |
| Produce subtotals/grand totals | ROLLUP / GROUPING SETS | Reporting-friendly totals |
Lessons
What's Next
- Continue to 8. Advanced SQL Features