Utilumo
LightDarkSystem

Updated July 2, 2026

SQL join types reference

A JOIN combines rows from two tables on a matching column. The join type decides which rows survive when there is no match. This sheet summarizes each type.

Join types

JoinRows keptTypical use
INNER JOINOnly rows matched in both tablesRecords that exist on both sides
LEFT JOINAll left rows + matched right (NULLs if none)Every main row, even without a match
RIGHT JOINAll right rows + matched left (NULLs if none)Mirror of LEFT; often rewritten as LEFT
FULL JOINAll rows from both, matched where possibleEverything from both tables
CROSS JOINEvery left row paired with every right rowCartesian product; rarely intended

LEFT JOIN example

SELECT users.name, orders.total
FROM users
LEFT JOIN orders ON orders.user_id = users.id;
A missing ON becomes a CROSS JOINForgetting or loosening the ON condition can silently produce a Cartesian product, multiplying your row count. Always join on a key that uniquely relates the tables.
NULLs from outer joinsLEFT, RIGHT, and FULL joins insert NULLs where there is no match. Filter on the joined table in WHERE carefully, since a condition on a NULL column can accidentally turn a LEFT JOIN back into an INNER JOIN.

References

Questions

What is the most common SQL join?

INNER JOIN is the most common, returning only rows that match in both tables. LEFT JOIN is next, used when you need to keep every row from the main table even without a match.

Is RIGHT JOIN necessary?

Rarely. Any RIGHT JOIN can be rewritten as a LEFT JOIN by swapping the table order, which most developers find easier to read, so LEFT JOIN is far more common in practice.