What does foreign key mean?

In databases & SQL, foreign key means a column in one table that points to the primary key of another table, linking the two and stopping you from storing references to rows that do not exist.

ˈfɔːrən kiːnounCore term

Databases & SQL vocabulary · Keys and Constraints

In Turkish: yabancı anahtar, dış anahtar, FK

Also used in: Software Engineering

How it is used

Shortened to FK. You add or drop a foreign key, and a 'foreign key constraint fails' error means the referenced row is missing or still has child rows. Teams sometimes debate whether to enforce foreign keys in the database or only in application code.

Example sentences

  1. orders.customer_id is a foreign key to customers.id.

  2. I can't delete this customer because of a foreign key constraint on the invoices table.

Common collocations

  • add a foreign key
  • foreign key constraint
  • foreign key reference
  • drop a foreign key

More terms: Keys and Constraints

Practise with graded reading

Reading at the right level is the fastest way to make new words stick. Pick free English books by level: