Keep all rows from the left table and match rows from the right when available.
Section: Join types at a glance
LEFT JOIN
sql
sql
SELECT c.customer_id, c.name, o.order_id
FROM customers c
LEFT JOIN orders o ON o.customer_id = c.customer_id;Explanation
Rows from `customers` without a matching order still appear, with right-side columns as `NULL`.
Learn the surrounding workflow
Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.
Related commands
Same sheet · prioritizing Join types at a glance
RIGHT JOIN
Keep all rows from the right table and match rows from the left when available.
Put right-side filters in ON when preserving outer rows
A `WHERE` clause can accidentally turn a left join into an inner join.
Join on stable keys
Prefer primary keys and foreign keys over names or free-form text.