SQL Guides
Concise, example-driven guides for every SQL concept you need as a business analyst — from your first SELECT to recursive CTEs.
SQL Tip of the Day
Use NULLIF(denominator, 0) instead of checking WHERE denominator != 0 — it keeps your row and returns NULL for the ratio instead of erroring or dropping the row entirely.
351total guides
22topic groups
3difficulty tiers
98rich interactive demos
Beginner
5 groupsSQL Foundations11SELECT, FROM, aliases, DISTINCT5 rich demosFiltering Data18WHERE, AND/OR, IN, BETWEEN, LIKE8 rich demosSorting & Limiting10ORDER BY, LIMIT, OFFSET, pagination4 rich demosAggregate Functions9COUNT, SUM, AVG, MIN, MAX5 rich demosData Types & Casting8types, CAST, PostgreSQL ::1 rich demos
Intermediate
8 groupsGrouping & Aggregation9GROUP BY, HAVING, conditional aggregation4 rich demosConditional Logic11CASE WHEN, COALESCE, NULLIF4 rich demosJoins23INNER, LEFT, RIGHT, FULL OUTER, SELF10 rich demosSet Operations8UNION, INTERSECT, EXCEPT5 rich demosDate & Time42EXTRACT, DATE_TRUNC, INTERVAL, YTD/MTD8 rich demosString Functions26CONCAT, TRIM, SUBSTRING, SPLIT_PART5 rich demosNULL Handling10three-valued logic, NULL in joins/aggregates4 rich demosNumeric Functions17ROUND, percentages, division by zero3 rich demos
Advanced
9 groupsSubqueries19scalar, correlated, EXISTS, IN vs EXISTS7 rich demosCTEs11WITH, chained CTEs, recursive CTEs5 rich demosWindow Functions42OVER, PARTITION BY, ROW_NUMBER, LAG/LEAD13 rich demosAnalytical Patterns & Business Metrics16churn, retention, cohorts, DAU/MAUInterview Patterns18duplicates, gaps & islands, anti-joins6 rich demosStatistical & Analytical SQL8median, percentiles, stddev, correlationQuery Performance21EXPLAIN, indexes, scan types1 rich demosViews & Materialized Views7views vs materialized viewsTransactions7BEGIN, COMMIT, ROLLBACK, SAVEPOINT