The Ultimate Guide to SQL JOINs: Visualizing Every Join Type, Cardinality, and Performance
By Sharon Ben-Moshe · October 13, 2026 · 3 min read
Sharon Ben-Moshe is the founder of sqlfmt, a browser-based SQL formatter and validator with misspelled-keyword suggestions across PostgreSQL, MySQL, SQLite, SQL Server, and BigQuery.
The definitive guide to SQL joins. Master INNER, LEFT, RIGHT, FULL OUTER, CROSS, and ANTI-JOINs, physical join algorithms, and cardinality pitfalls.
Quick answer
A SQL JOIN combines columns from two or more tables based on a related key expression. INNER JOIN returns rows matching both tables; LEFT JOIN preserves all left rows and fills unmatched right columns with NULL; FULL OUTER JOIN preserves all rows from both tables; and CROSS JOIN produces the Cartesian product (M × N). Physical execution relies on Nested Loop, Hash, or Merge Join algorithms.