Databases & SQL · reviewed in July 2026
JOIN (SQL)
A SQL JOIN combines rows from two or more tables based on a related column between them, usually a key. It lets you bring together data that lives in separate tables — for example customers and their orders — into a single query result.
SELECT c.name, o.total FROM orders o JOIN customers c ON c.id = o.customer_id;
Frequently asked questions
What's the difference between an INNER JOIN and a LEFT JOIN?
An INNER JOIN returns only the rows that have a match in both tables. A LEFT JOIN returns every row from the left table and fills the right table's columns with NULL where there is no match.
Which column do you JOIN on?
On a column that relates the two tables, named in the ON clause. It is usually a foreign key in one table pointing at the primary key of the other.
Can you join more than two tables?
Yes. You can chain several JOINs in one query to combine three or more tables; each JOIN adds its own ON condition against the result accumulated so far.