In traditional databases, joins are used to join one transaction table with another lookup table to generate a more complete view. For example, if you have a table of online transactions sorted by customer ID and another table containing the customer city and customer ID, you can use join to generate reports on the transactions sorted by city.
Transactions table: This table has three columns, the CustomerID, the Purchased item, and how much the customer paid for the item:
CustomerID | Purchased Item | Price Paid |
1 | Headphones | 25.00 |
2 | Watch | 20.00 |
3 | Keyboard | 20.00 |
1 | Mouse | 10.00 |
4 | Cable | 10.00 |
3 | Headphones | 30.00 |
Customer Info table: This table has two columns the CustomerID and the City the customer lives in:
Customer ID | City |
1 | Boston |
2 | New York |
3 | Philadelphia |
4 | Boston |
Joining the transaction table with the customer info table will generate a view as follows:
Customer ID | Purchased Item | Price Paid | City |
1 | Headphone | 25.00 | Boston |
2 | Watch | 100.00 | New York |
3 | Keyboard | 20.00 | Philadelphia |
1 | Mouse | 10.00 | Boston |
4 | Cable | 10.00 | Boston |
3 | Headphones | 30.00 | Philadelphia... |