LEFT JOIN
Question
What does LEFT JOIN return?
Hint
LEFT JOIN keeps all left rows even without matches.
Explanation
LEFT JOIN (LEFT OUTER JOIN) returns all rows from the left table and matched rows from the right table. Unmatched right rows show NULL. SELECT * FROM customers LEFT JOIN orders ON customers.id = orders.customer_id returns all customers, with NULL for order columns if a customer has no orders. LEFT JOIN is useful for finding records without matches: WHERE orders.id IS NULL finds customers with no orders. LEFT JOIN is not symmetric.
Related Resources
Related Lessons
- JOINs
Learn JOINs.
Look up unfamiliar terms
A beginner-friendly glossary explains jargon in plain English — variables, functions, DOM, Promise, and more.
Decode error messages
Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.
Build real projects
Apply what you learned by building guided projects with starter code and solutions.