Skip to main content
SQL Output Prediction Medium +20 XP

LEFT JOIN Nulls

What happens to customers with no orders in this query?

SQLRead-only
SELECT c.name, o.total
FROM customers c
LEFT JOIN orders o ON c.id = o.customer_id;

What is the output?

Show answer and explanation

Answer: They appear with NULL for total

LEFT JOIN returns all rows from the left table. Non-matching rows from the right table get NULL values.

Hint: LEFT JOIN keeps all left-side rows.

What this challenge tests

Output Prediction in SQL: left-join, nulls.

Related challenges