TheAnalyst / SQLAll lessons ↗
Day 13 · Aggregation & joins · 10–20 minutes

LEFT JOIN

LEFT JOIN keeps every row from the left table, even without a match.

01 · Learn

The idea

LEFT JOIN keeps every row from the left table, even without a match. Read the query line by line and identify the input table, the transformation, and the shape of the result before running it.

SELECT c.name, o.order_id FROM customers c LEFT JOIN orders o ON o.customer_id = c.customer_id ORDER BY c.customer_id, o.order_id;
Read it actively

Before running the example, predict the output columns and whether the query returns one row, many rows, or possibly no rows.

02 · Recall

Explain it without looking

In your own words, explain the main SQL feature in today’s lesson and why it answers the question.

03 · Solve

Run your own query

List all customers and any orders they have, including customers with no orders.

Loading browser SQL engine…
04 · Repeat

Close the loop