All jobs / Data analyst / BI / SQL
Data analyst / BI interview question · 0–1 years
When do you use LEFT JOIN instead of INNER?
The strongest answer
When you must keep the left grain even if the right side is missing — customers without orders still exist
Why it works
Exactly. INNER drops; LEFT keeps. Choose from the grain, not from a fear of NULL.
What a good answer covers
- LEFT keeps the left grain.
- INNER drops unmatched.
- Choose from the question.
- Do not hide a drop.
Answers that fall short
- Close, but not the strongest: Always LEFT, because it is safer
Always-LEFT invents rows you must then filter. - Weak: Always INNER, because NULLs are messy
Messy NULLs are information. - Red flag: When you want to hide unmatched rows from the stakeholder
Hiding unmatched is a silent INNER.
Who gets asked this
More SQL questions
- You need last month’s paid orders joined to customers. Where does the date filter go?
- A join fans one customer into five rows. What does COUNT(*) now mean?
- “Orders on 1 September” differs in Tel Aviv and UTC. What do you write on the dashboard?
- SELECT customer_id, SUM(amount) without GROUP BY — what is wrong?
- You LEFT JOIN orders, then WHERE orders.status = 'paid'. What did you just do?
- You need each order and the customer’s lifetime total on the same row. What do you use?
- You join orders to refunds (many refunds per order) then average order value. What bites you?
- A customer dimension has two rows per person after an address change. How do you join a fact?