Skip to main content

Joins for SQLs

Joins combine rows from two or more tables based on a related column, usually a foreign key matching a primary key. INNER, LEFT, RIGHT, FULL and CROSS joins differ in which unmatched rows are kept. Subqueries, including correlated ones and EXISTS, let one query use the result of another.

Stage: Multiple Tables · Part of the SQL roadmap · Last reviewed 19 November 2026

What to learn in Joins

Joins interview questions

What is the difference between INNER JOIN and LEFT JOIN?

INNER JOIN returns only rows that have a match in both tables. LEFT JOIN returns every row from the left table and fills columns from the right table with NULL where no match exists. LEFT JOIN is used to find items with no related records, like customers without orders.

How do you find rows in one table that have no match in another?

Use a LEFT JOIN and filter for NULL in the right table's key, or use NOT EXISTS with a correlated subquery. NOT EXISTS is often clearest and handles NULLs safely. Avoid NOT IN when the subquery column can contain NULL, because it can return no rows.

Where Joins fits in the SQL roadmap

Joins belongs to the Multiple Tables stage (beginner level), which takes about 18 hours. Relate data across tables.

Back to the full SQL roadmap