A foreign key is a column (or group of columns) in a relational database table that provides a link between data in two tables. A foreign key in one table corresponds to a primary key in another table.
A primary key uniquely identifies each record in a database table. Primary keys cannot contain null values. Each table in the relational database can only have one primary key. When rows in the parent table (the table containing the primary key value) are deleted, the matching foreign key records in the child table (the table with corresponding foreign key) are also deleted, thus creating a cascading delete. This logical constraint ensures referential integrity of data in the relational database.