LEFT (OUTER) JOIN: Keeps every row from the left table; right-table columns are NULL where there is no match. A LEFT JOIN, also called a left outer join, keeps every row from the left table, even when there is no match in the right table. Missing values from the right side become NULL.
Frequently asked questions about LEFT (OUTER) JOIN
How is LEFT (OUTER) JOIN used in practice?
SELECT users.name, COUNT(orders.id) FROM users LEFT JOIN orders ON ... GROUP BY users.id lists every user with their order count, including users with zero orders. An inner join would drop them.
What should you keep in mind with LEFT (OUTER) JOIN?
It is also the standard way to find missing data. LEFT JOIN followed by WHERE orders.id IS NULL returns users who have never ordered. One common mistake is putting a condition on the right table in WHERE instead of in the ON clause, which silently turns the left join back into an inner join.
What does an example of LEFT (OUTER) JOIN look like?
SELECT u.name, o.total FROM users u LEFT JOIN orders o ON o.user_id = u.id;