"Out of many, one"
1. "Out of many, one"
If you look on the back of US currency, you'll see the Latin words "E Pluribus Unum" which means "Out of Many, one. In this chapter we'll focus on a type of join that does just that, the one-to-many join.2. One-to-many joins
We discussed the basic idea of one-to-many joins in Chapter 1. You may recall the defining characteristic of these joins is that each row in one table corresponds to many rows in another table. Notice how the blue table on the left has one row with GameKey 2 and the yellow table on the right has two rows with GameKey 2. The table resulting from a one-to-many merge has a row structure that mirrors the level of detail in the yellow table. Data merged in from the blue table repeats by row as needed to match the new structure.3. Revisiting the framework
Remember our framework for joins? We can use it to help construct a one-to-many join. Again, the first step is to determine the relationship of the datasets. We do that by focusing on the key columns.4. Relationship examples
Here we have several examples of one-to-many relationships. Time relationships are a straightforward case. One month contains around 30 days and one hour contains 60 minutes. Other types of hierarchy have a similar relationship, such as companies and their departments or Nations and their cities. A one-to-many relationship can also come from different types of entities as long as the data is organized properly. For example, a customer database might have several purchase orders per customer. You could join order data to another table with customer-level data like address and phone number. Likewise, a data table containing descriptive data for several departments could be merged with a table breaking down annual expenses for each department.5. Let's practice!
Now that you’re armed with some basic knowledge of one-to-many joins, it's time to practice.Create Your Free Account
or
By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.