From the course: Database Foundations: Data Structures

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

What are foreign keys?

What are foreign keys?

From the course: Database Foundations: Data Structures

Start my 1-month free trial

What are foreign keys?

- [Instructor] There's one more type of key value that's important to the structure of a relational database, and they're called foreign keys. Believe it or not, you've already seen them in action throughout this course. Think back to our normalization of the pet and owner database. We wound up with three tables, one for owners, one for locations where they live, and one for their pets. These three tables were given a unique primary key column to identify every row in each of these tables. Now, in order to relate information together, we added two additional columns to the databases structure, one column in and the owners table that points to the related address information for each person, and we also had a column in the pets table that points to the related owner information for each pet. These columns are the foreign keys, and they're used to connect related rows back together again. Foreign key columns store the…

Contents