A join combines two tables by matching values in a shared key column or columns. It creates a new table that brings together information about the same entity from both sources. Think of it as connecting a customer profile to that customer’s transaction records using CustomerID. section 7.2
First identify the left and right tables and choose the shared key. Then decide which unmatched rows belong in the result. A customer can match multiple transaction rows, so the customer details appear alongside each matching purchase. section 7.2
Including customers without purchases
Customer Master Data is the left table and Transaction History is the right table. Matching on CustomerID links CUST002 to two purchases. Including every left-table row also retains CUST003, whose transaction fields are empty, so that customer can still receive an email. A transaction-only ID such as CUST085 is not retained by this choice. section 7.2
|
CustomerID |
FirstName |
Age |
City |
ProductName |
PurchaseDate |
Amount |
| CUST001 |
Rebecca |
53 |
Manchester |
? |
? |
? |
| CUST002 |
Maicol |
41 |
Milan |
Sleep Lamp |
2025-01-25 |
439.96 |
| CUST002 |
Maicol |
41 |
Milan |
Essential Oil Diffuser |
2025-03-10 |
288.00 |
| CUST003 |
Giulia |
37 |
Milan |
? |
? |
? |
Inspect the joined result to see repeated customer details for multiple purchases and empty transaction fields for customers without matches. section 7.2















