Query Systems · Knowledge Base
From first queries to advanced analytics. Joins, aggregation, and window functions; query reasoning and debugging; and the performance judgment to write SQL that stays correct — and cheap — at scale.
StartRead a table and its grain, shape a query, select and filter deliberately, handle types and NULLs, count safely, and inspect results like an engineer.
Read chapter →Join types, grain, cardinality, duplicate explosions, and the habit of proving why rows multiplied.
Read chapter →Grouped metrics, HAVING filters, distinct counts, conditional aggregation, and trustworthy metric definitions.
Read chapter →Layered query design, debuggable intermediate results, and SQL that is easy to narrate in interviews.
Read chapter →Ranking, offsets, running totals, deduplication, retention, cohorts, and event sequence analysis.
Read chapter →Timestamp logic, time zones, event tables, JSON, arrays, late data, and ordering tradeoffs.
Read chapter →Incremental loads, MERGE patterns, upserts, slowly changing dimensions, snapshots, and backfills.
Read chapter →Duplicate checks, null checks, referential tests, reconciliation, anomaly queries, and audit evidence.
Read chapter →Partitions, clustering, pruning, query plans, scan cost, and warehouse-aware optimization habits.
Read chapter →Clarifying assumptions, narrating query logic, debugging live, and explaining senior-level tradeoffs.
Read chapter →