Aggregation

GROUP BY correctness, GROUPING SETS, ROLLUP, CUBE, FILTER, and the multi-level CTE patterns that make complex reporting reliable.

Aggregation is where most SQL bugs live — join amplification, missing NULLs, HAVING confusion. These lessons cover how GROUP BY really works, the FILTER clause for multiple counts in one pass, and the advanced grouping features (GROUPING SETS, ROLLUP, CUBE) that replace repeated queries.

Paired course

Reliable Aggregation

Go deeper with structured exercises, datasets, and production patterns.

See the Course

Go deeper

The Art of PostgreSQL

These lessons are the foundation. The book gives you the complete treatment, with real datasets you can run and the production patterns that turn thousands of lines of code into simple queries.

Get the Book — $89