From 897abd7c164006107f4ebc56c526cf11e84d2bb1 Mon Sep 17 00:00:00 2001 From: koalabearski Date: Fri, 22 Jul 2016 12:27:33 -0400 Subject: [PATCH] Update relational-data.Rmd (#124) fixed a typo for clarity --- relational-data.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/relational-data.Rmd b/relational-data.Rmd index c5fe92a..0a91a94 100644 --- a/relational-data.Rmd +++ b/relational-data.Rmd @@ -131,7 +131,7 @@ flights %>% count(year, month, day, tailnum) %>% filter(n > 1) When starting to work with this data, I had naively assumed that each flight number would be only used once per day: that would make it much easier to communicate problems with a specific flight. Unfortunately that is not the case! If a table lacks a primary key, it's sometimes useful to add one with `row_number()`. That makes it easier to match observations if you've done some filtering and want to check back in with the original data. This is called a surrogate key. -A primary key and the corresponding foreign key in another table form a __relation__. Relations are typically one-to-many. For example, each flight has one plane, but each plane has many flights. In other data, you'll occasionally see a 1-to-1 relationship. You can think of this as a special case of 1-to-many. It's possible to model many-to-many relations with a many-to-1 relation plus a 1-to-many relation. For example, in this data there's a many-to-many relationship between airlines and airports: each airport flies to many airlines; each airport hosts many airlines. +A primary key and the corresponding foreign key in another table form a __relation__. Relations are typically one-to-many. For example, each flight has one plane, but each plane has many flights. In other data, you'll occasionally see a 1-to-1 relationship. You can think of this as a special case of 1-to-many. It's possible to model many-to-many relations with a many-to-1 relation plus a 1-to-many relation. For example, in this data there's a many-to-many relationship between airlines and airports: each airline flies to many airports; each airport hosts many airlines. ### Exercises