SQL Deep Dive
Go beyond SELECT * : how SQL evaluates queries, joins without surprises, window functions, recursive CTEs, analytical patterns and index-friendly queries, with every query run on PostgreSQL 16.
What you'll learn
- Predict what a query returns by reasoning about SQL's logical evaluation order and NULL behaviour.
- Choose the right join, including semi-joins and anti-joins, and avoid fan-out double counting.
- Summarise data with GROUP BY, HAVING, FILTER, ROLLUP and conditional-aggregation pivots.
- Use window functions for ranking, top-N per group, running totals, moving averages and shares.
- Solve analytical patterns: recursive hierarchies, LATERAL top-N, gap filling, gaps-and-islands and deduplication.
- Change data safely with MERGE, UPDATE ... FROM and transactions, and write index-friendly queries checked with EXPLAIN.
Syllabus
How SQL Thinks
Joins Without Surprises
Aggregation and Reporting
- GROUP BY, HAVING and FILTER
- Subtotals With ROLLUP and GROUPING SETS
- Pivoting With Conditional Aggregation