Foreign Key
Foreign keys are used to identify records stored in other database tables that are related to the records in the current table. The following table contains a list of departments.
| Primary Key | Department |
| 1 | Sales |
| 2 | Marketing |
| 3 | Support |
The following table contains employee data.
| Primary Key | Department | First Name | Last Name |
| 1 | 3 | Betty | Miller |
| 2 | 2 | Sam | Cook |
| 3 | 2 | Ralf | Miller |
| 4 | 1 | Sam | Hampton |
The department's primary key is stored here as a foreign key in the "Department" column. This makes it very easy to determine, for example, that Betty Miller works in the Support department.