notes src foreign-key.md
465 B · 9 lines
Markdown
at main

Foreign Key #

A foreign key in a @[relational database][] refers to the use of a @[key][] of one @[relation][database-relation] being used (referenced) by a second relation, forming a relationship between the two.

By using foreign keys, we can ensure that data from one table only references data that actually exists on another table, creating a very powerful way to describe the relationships between objects and prevent invalid situations from occurring.