Section 1 - Instruction

Last time you learned INNER JOIN, which only shows records that exist in BOTH tables. But what if you want to see ALL customers, even those who never placed an order?

INNER JOIN would hide customers without orders. Sometimes you need to keep all records from one table regardless of matches.

Engagement Message

Can you think of a business scenario where you'd want to see all customers, including those with no orders?

Section 2 - Instruction

LEFT JOIN solves this! It keeps ALL records from the left table (the first one mentioned) and adds matching data from the right table.

When there's no match, the right table's columns show NULL values instead of disappearing entirely.

Engagement Message

Which table is "left" in this query: FROM customers LEFT JOIN orders?

Section 3 - Instruction

Here's our familiar data:

CUSTOMERS

customer_idname
1Sarah
2Mike
3Lisa

ORDERS

order_idcustomer_idproduct
1011laptop
1022phone
1031mouse

Remember: INNER JOIN excluded Lisa because she had no orders.

Engagement Message

What do you think LEFT JOIN will do with Lisa?

Section 4 - Instruction

LEFT JOIN results would look like:

nameproduct
Sarahlaptop
Sarahmouse
Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal