Skip to main content

What does LEFT JOIN do?

LEFT JOIN returns all rows from the left table (the one listed first in the query), and only the matching rows from the right one.

If the right table has no match, NULL fills its place.

Example

sql
SELECT * FROM customers LEFT JOIN orders ON customers.id = orders.customer_id;

Here, every customer ends up in the result, and for those with no orders, the orders columns come back as NULL.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.