Skip to main content

Learn · SQL Joins

SQL joins, visually

Joins are where most SQL confusion lives. Pick a join type and watch exactly which rows get matched between two tables — and, crucially, where the NULLs come from. Same two tables, four very different answers.

Join:

customers

orders

result

matched rows · NULL = no match on the other side. The join key here is customers.id = orders.customer_id.

The one-line mental model

INNER keeps only rows that match on both sides. LEFT keeps every left row (customers), padding NULLs where there's no order. RIGHT does the same for the right table (orders) — note the order for customer #5, who doesn't exist. FULL OUTER keeps everything from both, NULLs wherever either side is missing. The join computes in your browser — this is the data-engineering bread and butter behind every report and pipeline.