Return all rows from the left table and matching rows from the right table.
Section: joins
Left join to keep unmatched parent rows
sql
sql
SELECT u.id, u.email, o.id AS order_id
FROM users u
LEFT JOIN orders o ON o.user_id = u.id;Explanation
Rows from `users` remain even when there is no matching row in `orders`.
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 joins