29. SQL for Excel Users (Term Map + Side-by-Side)
29.3 JOIN = XLOOKUP / Power Query Merge
Why. XLOOKUP / Merge bring columns from another table — JOIN does that in SQL.
What. INNER JOIN keeps matches. LEFT JOIN keeps all left rows (like merge left).
How. Idea now; deep JOIN chapters come later — still show one tiny join.
Steps
- Match orders to customer names.
- See customer_id as the lookup key.
- Link Power Query Merge in your mind.
Examples
Example 1 · dataset: raja_coffee
SELECT o.order_id, c.name, o.city, o.amount_inr
FROM orders AS o
JOIN customers AS c ON c.customer_id = o.customer_id
ORDER BY o.order_id
LIMIT 5;Output
| order_id | name | city | amount_inr |
|---|---|---|---|
| 1001 | Asha Patil | Pune | 840.0 |
| 1002 | Omar Khan | Mumbai | 720.0 |
| 1003 | Sofia Mendes | Goa | 890.0 |
| 1004 | James Okonkwo | Pune | 1050.0 |
| 1005 | Priya Deshmukh | Kolhapur | 620.0 |
Meaning. Lookup customer name onto each order.
Ravindra Bagale's Tip
If row counts explode after a join, you have a many-to-many — stop and check keys.
Ravindra Bagale's Tip – मराठी
Join नंतर रो संख्या फुगली तर many-to-many — थांबा आणि keys तपासा.
Ravindra Bagale's Tip – हिंदी
Join के बाद पंक्तियाँ फूलें तो many-to-many — रुकें और keys जाँचें।