13. Foreign Key

DEFINITION:

A foreign key is used to link tables together and create a relationship. It is a field in one table that is linked to the primary key in another table.

 

foreign key

 

In the database above there are three tables:

  • Artists
  • Recordings
  • Genre

The primary key in the Artists table is: ArtistID

The primary key in the Genre table is: GenreID

These primary keys link to identically named fields in the Recordings table. Each of those identically named fields are known as a 'foreign key'

 

challenge see if you can find out one extra fact on this topic that we haven't already told you

Click on this link: Foreign Key