What is Left Join?

A left join keeps every row from the first (left) table and attaches matching rows from the second table, with nulls where nothing matches.

Left Join explained

Use it when the left table is the list you care about and the right table is optional extra information: all customers, with their orders if any.

Unmatched rows show nulls in the right-hand columns, which is also how you find them: filtering for those nulls gives 'customers with no orders'. A condition on the right table placed in WHERE instead of ON quietly turns the left join into an inner join.

Example

Listing all products with their sales this month, and zero for products that had none, needs a left join from products to sales.

Frequently asked questions

What is Left Join?
A left join keeps every row from the first (left) table and attaches matching rows from the second table, with nulls where nothing matches.
Can you give an example of Left Join?
Listing all products with their sales this month, and zero for products that had none, needs a left join from products to sales.