SQL Data Analytics • Lesson 14
Advanced JOINs
Learn how LEFT JOIN, RIGHT JOIN and unmatched records help analysts find information a basic INNER JOIN would miss.
0 of 8 concepts completed
Complete the activity and related MCQ to unlock the next concept.
Why Analysts Need Different JOIN Types
INNER JOIN only returns matching rows. But analysts often need to find the rows that don't match — customers with no orders, orders with no customer, records missing from one side of the relationship.
Interactive Data
Customers & Orders
Arjun exists in Customers but has no order — the classic case where LEFT JOIN reveals what INNER JOIN hides.
Customers
| customer_id | name | city |
|---|---|---|
| 101 | Rahul | Delhi |
| 102 | Priya | Mumbai |
| 103 | Amit | Pune |
| 104 | Neha | Delhi(no orders) |
| 105 | Arjun | Jaipur(no orders) |
Orders
| order_id | customer_id | amount |
|---|---|---|
| 5001 | 101 | ₹2,500 |
| 5002 | 102 | ₹7,000 |
| 5003 | 101 | ₹4,500 |
| 5004 | 103 | ₹3,200 |
LEFT JOIN result (all customers)
| name | order_id | amount |
|---|---|---|
| Rahul | 5001 | ₹2,500 |
| Rahul | 5003 | ₹4,500 |
| Priya | 5002 | ₹7,000 |
| Amit | 5004 | ₹3,200 |
| Neha | NULL | NULL |
| Arjun | NULL | NULL |
Learn by Seeing
Three JOIN types
INNER JOIN → matches only LEFT JOIN → all left rows RIGHT JOIN → all right rows
Choosing the right JOIN type is what lets you see unmatched data instead of hiding it.
Switch JOIN type — see how the result changes:
Interactive Activity
Why do analysts use LEFT and RIGHT JOINs?
Hint: Think about customers with no orders.
SQL Analyst Mindset
Finding gaps is as valuable as finding matches
Inactive customers, missing transactions, orphan keys — these are the questions analysts answer with LEFT JOIN + IS NULL. Knowing which JOIN type to reach for is what turns a query into an insight.
Ask the question
Matches or gaps?
Pick the JOIN
INNER, LEFT, or RIGHT?
Filter NULLs
IS NULL when looking for gaps.
Interpret
NULLs mean missing data, not zero.
Frequently Asked Questions
Advanced JOINs — FAQs
Use LEFT JOIN when you want to keep every row from the left table — even those without a match on the right side.
It works, but most teams rewrite RIGHT JOIN as LEFT JOIN with reversed table order for consistency and readability.
It checks whether the corresponding row in the other table exists. NULL means no match was found.
No — LEFT JOIN always returns at least one row per left-table row. It can return more if multiple right rows match.
Lesson Summary
What you learned
Keeps every left row; right side becomes NULL without a match.
Keeps every right row; left side becomes NULL without a match.
Find rows without a matching partner.
A missing value, not zero.