Video coming soon
Notes
Aggregates such as COUNT, SUM and AVG collapse rows into one value per group.
WHERE filters before grouping; HAVING filters groups afterwards.
Key points
- Every non-aggregated column goes in GROUP BY.
- Use HAVING for conditions on aggregates.
- COUNT(DISTINCT x) counts unique values.