SQL Quest Blog
Long-form SQL tutorials and deep-dives. Each post is opinionated, has runnable examples, and links into the practice app so the patterns actually stick. Topics expand monthly.
SQL JOINs Explained โ Every Type, With Real Examples
INNER, LEFT, RIGHT, FULL, CROSS, SELF โ every JOIN type with the WHERE-vs-ON LEFT JOIN bug as the centerpiece (the most expensive bug in production analytics SQL). Anti-join patterns, multi-table chains, five common mistakes that defeat most analysts.
Read the JOINs guideSQL Window Functions Tutorial โ RANK, LAG, Running Totals
ROW_NUMBER vs RANK vs DENSE_RANK with the side-by-side tie-handling table. PARTITION BY mental model, LAG/LEAD, ROWS BETWEEN frames, top-N per group as the most-asked interview pattern, plus five interview patterns to memorize.
Read the window functions guideNULL Handling in SQL โ The 5 Mistakes That Defeat Most Analysts
Why col = NULL never matches, the NOT IN trap with nullable subqueries, COUNT(*) vs COUNT(col), NULL contagion in arithmetic, and a NULL checklist for code review.
SQL CTEs Explained โ WITH Clause, Recursive CTEs, Subqueries
CTE vs subquery decision matrix, multi-CTE chains, recursive CTEs (anchor + recursive step + termination), org-chart and sequence-generation patterns, performance notes including the Postgres โค11 fence, and three CTE anti-patterns.
Read the CTE guideSQL GROUP BY Tutorial โ Aggregation, HAVING, and the 5 Mistakes Most Analysts Make
The mental model for grouping, the one rule that prevents 80% of bugs, HAVING vs WHERE with execution order, conditional aggregation with CASE, ROLLUP/CUBE/GROUPING SETS, and the five mistakes that defeat most analysts.
Read the GROUP BY guideSQL CASE WHEN Tutorial โ Conditional Logic, Pivots, and the Common Bugs
Simple vs searched syntax, CASE in SELECT/ORDER BY/WHERE/GROUP BY, the conditional aggregation workhorse, CASE-based pivoting that works on every database, the NULL trap, and the 4 common bugs.
Read the CASE WHEN guideSQL for Fraud Analytics โ 5 Patterns Every Fraud Analyst Writes Weekly
Anomaly bounds (3-sigma, IQR), velocity rules with window functions, geographic mismatch with Haversine, cross-account self-join collusion detection, and recursive CTEs for chargeback investigation. Runnable examples on FDIC banking data.
Read the fraud analytics guideThe Complete FAANG SQL Interview Guide (2026)
Everything you need to ace the SQL interview at Meta, Google, Amazon, Apple, and Netflix. Topics by frequency, question patterns by company, and a 30-day study plan with concrete daily targets.
Read the FAANG guideMore tutorials coming. Want a specific topic covered? Email us.