Guides
SQL, explained in depth
Long-form articles that go beyond the lessons: how queries really run, how to avoid answers that look right but are not, and the patterns analysts use every day. Every example runs on the LearnWithSQL sample databases.
SQL order of execution: how a query actually runs
SQL is written SELECT-first but evaluated FROM-first. Learn the logical order of every clause and the bugs it explains: aliases in WHERE, HAVING vs WHERE, and filtering window functions.
8 min read
Which SQL join should I use? A practical decision guide
INNER, LEFT, FULL, CROSS or EXISTS? A decision guide based on the question you are answering, with the row-count checks that catch duplicated and missing rows.
9 min read
SQL interview questions with worked answers
Fifteen SQL interview questions asked for analyst and engineer roles, each with a worked answer, the query, and what the interviewer is really checking.
12 min read
PostgreSQL vs MySQL: the syntax differences that matter
A side-by-side reference of the SQL syntax that differs between PostgreSQL and MySQL: strings, dates, limits, upserts, booleans, case sensitivity and more.
10 min read
8 SQL patterns every data analyst uses
The query shapes behind most analytics work: top N per group, period-over-period change, running totals, cohorts, funnels, deduplication, percent of total and gap-filling.
11 min read
SQL mistakes that silently return wrong answers
The SQL bugs that do not raise errors: NULL comparisons, integer division, join fan-out, BETWEEN on timestamps, NOT IN with NULLs, and more, with fixes for each.
9 min read