7. Grouping & Filtering
This module teaches you how to summarize datasets and filter aggregate results without breaking query correctness.
Lessons
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 rows early for better performance |
| Filter grouped results | HAVING | Evaluates conditions after aggregation |
| Add subtotal and grand total rows | WITH ROLLUP | Generates reporting-friendly totals |
What's Next
- Continue to 8. Advanced SQL Features