thinQmaster Virtual testing partner Adaptive practice exams that find your weak spots and drill them. Every answer explained. From $69
Enroll

thinQmaster

Find your exam

Five questions free, before you decide.

Step 1 · choose a vendor

In one of our camps? Your practice exams come with the tuition — they are on your study page already.

Data & Analytics · Foundational

Foreign Key (FK)

A column in one table that references the primary or unique key of another table, enforcing a relationship between them.

Definition

A foreign key constraint ensures that every non-null value in the referencing column exists in the referenced key, which preserves referential integrity. Foreign keys implement one-to-many relationships, with the foreign key on the 'many' side. They may be NULL unless declared NOT NULL.

Example

Orders.CustomerID REFERENCES Customers(CustomerID)

Exam tip

The foreign key lives on the 'many' side of a one-to-many relationship, and unlike a primary key it can repeat and can be NULL.

Don't confuse it with

Related terms