</>CodexBash
All articles
Databases

SQL joins

SQL joins explained with two small tables and their exact results: inner, left, right and full outer joins, cross joins, self joins, joining on several conditions, the ON versus WHERE trap, anti-joins for finding missing rows, duplicate rows from one-to-many joins, and performance.

CodexBash, , 6 min read

Relational databases split data across tables, customers in one, orders in another, so each fact is stored once. Joins bring them back together in a query. They are the most important SQL skill after SELECT itself, appear in nearly every interview that touches databases, and are behind many confusing bugs, such as rows mysteriously vanishing or totals coming out doubled. This article explains each kind of join using two tiny tables, showing the exact result every time.

Sign in to read the rest

The whole 6 minute article is free with an account, along with every problem, lesson and tutorial. No card.