Skip to content
LakeBench
ProblemsCommunityPricing
Sign inStart practicing
Back
  1. Home
  2. Interview prep
  3. INNER JOIN vs LEFT JOIN

SQL · Basics & Joins

INNER JOIN vs LEFT JOIN

Easysql-01
joinsinner joinleft join

Question

What is the difference between INNER JOIN and LEFT JOIN?

Solution

INNER JOIN returns only rows that have a matching record in both tables.

LEFT JOIN returns all rows from the left table, plus matching rows from the right table. If there is no match, right-side columns become NULL.

SELECT *
FROM customers c
INNER JOIN orders o
    ON c.id = o.customer_id;

Only customers who have orders are returned.

SELECT *
FROM customers c
LEFT JOIN orders o
    ON c.id = o.customer_id;

All customers are returned, including customers with no orders.

Interview shortcut:

> INNER = matching rows only > LEFT = everything from left + matches from right

🎯 Put this concept into practice

Solidify this answer with real hands-on interview drills in the browser studio.

Open related drill →
Next