Skip to main content

7. Grouping & Filtering

This module teaches you how to summarize datasets and filter aggregate results without breaking query correctness.

Lessons

Decision Guide

GoalClause to useWhy
Group rows by one or more keysGROUP BYProduces aggregate result sets
Filter rows before groupingWHEREReduces rows early for better performance
Filter grouped resultsHAVINGEvaluates conditions after aggregation
Add subtotal and grand total rowsWITH ROLLUPGenerates reporting-friendly totals

What's Next