Often two tables in a relational database are related. I’ll give you a second to let that shock wear off….

Because the tables are related, it can be helpful to have rules in place to force the data to maintain this relationship. Often these are done with objects called keys. A primary key defines and enforces a unique set of data in a table. A foreign key on a second table forces the second table to only allow records that match data in that primary key. This enforcement is called referential integrity.