The foreign key is a key in one table that refers to the primary key of another table. The foreign key is basically used to link two tables.
Database
integrity
• The foreign key is a key in one table that refers
to the primary key of another table.
• The foreign key is basically used to link two
tables. For example
Consider Customer table as follows –

• Note that the "CustID"
column in the "Order" table points to the "CustID" column
in the "Customer" table.
• The "CustID" column in the
"Customer" table is the PRIMARY KEY in the"Customer" table.
• The "CustID" column in the
"Order" table is a FOREIGN KEY in the "Order" table.
• The table containing the foreign key
is called the child table, and the table containing the primary key is called
the referenced or parent table.
• The FOREIGN KEY constraint is used
to prevent actions that would destroy links between tables.
• The FOREIGN KEY constraint also prevents invalid
data from being inserted into the foreign key column, because it has to be one
of the values contained in the table it points to.
Database Management System: Unit I: Relational Databases : Tag: : Relational Databases - Database Management System - Database Integrity
Database Management System
CS3492 4th Semester CSE Dept | 2021 Regulation | 4th Semester CSE Dept 2021 Regulation
Environmental Sciences and Sustainability
GE3451 ESS 4th Semester | 2021 Regulation | 4th Semester EEE Dept 2021 Regulation
Theory of Computation
CS3452 4th Semester CSE Dept | 2021 Regulation | 4th Semester CSE Dept 2021 Regulation
Artificial Intelligence and Machine Learning
CS3491 4th Semester CSE/ECE Dept | 2021 Regulation | 4th Semester CSE/ECE Dept 2021 Regulation
Database Management System
CS3492 4th Semester CSE Dept | 2021 Regulation | 4th Semester CSE Dept 2021 Regulation
Algorithms
CS3401 4th Semester CSE Dept | 2021 Regulation | 4th Semester CSE Dept 2021 Regulation
Introduction to Operating Systems
CS3451 4th Semester CSE Dept | 2021 Regulation | 4th Semester CSE Dept 2021 Regulation