Foreign key
Meaning in software engineering, with examples
In software engineering, 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.
In Turkish: yabancı anahtar, dış anahtar, FK
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
orders.customer_id is a foreign key to customers.id.
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
Related terms
This word in other fields
The same English word can have a different meaning in another field:
More terms: Databases and Persistence
Practise with graded reading
Reading at the right level is the fastest way to make new words stick. Pick free English books by level:
