Skip to content

Commit

Permalink
Move exericse to better place
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Apr 18, 2021
1 parent 023606e commit ef21701
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions relational-data.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,6 @@ For nycflights13:
3. `weather` only contains information for the origin (NYC) airports.
If it contained weather records for all airports in the USA, what additional relation would it define with `flights`?

4. We know that some days of the year are "special", and fewer people than usual fly on them.
How might you represent that data as a data frame?
What would be the primary keys of that table?
How would it connect to the existing tables?

## Keys

The variables used to connect each pair of tables are called **keys**.
Expand Down Expand Up @@ -165,7 +160,12 @@ For example, in this data there's a many-to-many relationship between airlines a

1. Add a surrogate key to `flights`.

2. Identify the keys in the following datasets
2. We know that some days of the year are "special", and fewer people than usual fly on them.
How might you represent that data as a data frame?
What would be the primary keys of that table?
How would it connect to the existing tables?

3. Identify the keys in the following datasets

a. `Lahman::Batting`,
b. `babynames::babynames`
Expand All @@ -175,7 +175,7 @@ For example, in this data there's a many-to-many relationship between airlines a

(You might need to install some packages and read some documentation.)

3. Draw a diagram illustrating the connections between the `Batting`, `People`, and `Salaries` tables in the Lahman package.
4. Draw a diagram illustrating the connections between the `Batting`, `People`, and `Salaries` tables in the Lahman package.
Draw another diagram that shows the relationship between `People`, `Managers`, `AwardsManagers`.

How would you characterise the relationship between the `Batting`, `Pitching`, and `Fielding` tables?
Expand Down

0 comments on commit ef21701

Please sign in to comment.