Quick answer

INNER JOIN returns only rows that match in both tables. LEFT JOIN returns all rows from the left table, plus matching rows from the right table.

That means the real difference is what happens to rows that do not have a match:

  • INNER JOIN: unmatched rows disappear
  • LEFT JOIN: unmatched left-side rows stay, with NULL on the right side
Tip: If your main goal is “do not lose rows from my main table,” you usually want LEFT JOIN.

In this guide

Sample tables

Suppose you have these two tables:

customers

customer_id name
1 Ana
2 Ben
3 Chris
4 Dana

orders

order_id customer_id amount
101 1 50
102 2 75
103 2 20
Notice that Chris and Dana do not have matching rows in the orders table. That is exactly what makes INNER JOIN and LEFT JOIN behave differently.

What INNER JOIN does

INNER JOIN keeps only rows where the join condition matches in both tables.

SELECT c.customer_id, c.name, o.order_id, o.amount
FROM customers c
INNER JOIN orders o
  ON c.customer_id = o.customer_id;

This query returns:

customer_id name order_id amount
1 Ana 101 50
2 Ben 102 75
2 Ben 103 20
Chris and Dana do not appear because they do not have matching rows in the orders table.

What LEFT JOIN does

LEFT JOIN keeps every row from the left table, even when there is no match in the right table.

SELECT c.customer_id, c.name, o.order_id, o.amount
FROM customers c
LEFT JOIN orders o
  ON c.customer_id = o.customer_id;

This query returns:

customer_id name order_id amount
1 Ana 101 50
2 Ben 102 75
2 Ben 103 20
3 Chris NULL NULL
4 Dana NULL NULL
Chris and Dana stay in the result because LEFT JOIN keeps all rows from customers, the left table.

Compare the results

INNER JOIN returns only rows where both sides match.
LEFT JOIN returns all left-table rows, even if the right side is missing.
Unmatched right-side values show up as NULL in a LEFT JOIN.
A simple memory trick is: INNER = overlap only. LEFT = keep the left table intact.

Why NULL values appear

In a LEFT JOIN, when SQL cannot find a matching row on the right side, it still keeps the left-side row. Since there is no right-side data to show, SQL fills those right-side columns with NULL.

That is why Chris and Dana appear in the LEFT JOIN result with NULL for order_id and amount.

NULL in this case does not mean “zero.” It means “there was no matching row.”

Finding missing matches

One of the most useful LEFT JOIN patterns is finding rows that do not have a match in another table.

SELECT c.customer_id, c.name
FROM customers c
LEFT JOIN orders o
  ON c.customer_id = o.customer_id
WHERE o.order_id IS NULL;

This returns customers who have no orders.

This pattern shows up all the time in real work: customers without orders, products without sales, employees without departments, and more.

When to use each one

Use INNER JOIN when:

  • you only care about rows that definitely match
  • unmatched rows should be excluded
  • you want related records only

Use LEFT JOIN when:

  • you need all rows from the main table
  • you want to preserve missing relationships
  • you want to find rows with no match
If you are unsure which one to use, ask yourself: “Do I want to keep all rows from my main table, even when there is no match?” If the answer is yes, use LEFT JOIN.

Common mistakes

  • Using INNER JOIN when you actually needed to keep unmatched rows
  • Forgetting that LEFT JOIN can produce NULL values on the right side
  • Putting filters in the wrong place and accidentally turning a LEFT JOIN into an INNER JOIN
  • Joining on the wrong key column
  • Assuming one row on the left always matches only one row on the right
Be careful with WHERE clauses after a LEFT JOIN. Some filters can remove the unmatched rows you were trying to keep.

Practice questions

1. Write an INNER JOIN between customers and orders.
2. Write a LEFT JOIN that keeps all customers.
3. Find customers who do not have any orders.
4. Explain why Ben appears more than once in the join results.
5. Explain why Chris appears in LEFT JOIN output but not INNER JOIN output.

Bottom line

INNER JOIN returns only matching rows. LEFT JOIN keeps everything from the left table and fills missing right-side values with NULL.

If you remember that one rule, join behavior gets much easier to predict.

Quick memory trick: INNER = only shared matches. LEFT = keep everything on the left.

Related SQL tutorials

SQL Hub
Start here for all SQL topics and tutorials.
SQL Joins Explained
Learn the broader idea of how joins connect separate tables together.
GROUP BY
Learn how to summarize grouped data after joining tables together.
Aggregate Functions
Understand COUNT, SUM, AVG, MIN, and MAX for reporting and analysis.