Definition: Foreign keys are the columns of a table that points to the primary key of another table. They act as a cross-reference between tables.
In the below example the
Stu_Id column in
Course_enrollment table is a foreign key as it points to the primary key of the Student table.
Note: Practically, the foreign key has nothing to do with the primary key tag of another table, if it points to a unique column (not necessarily a primary key) of another table then too, it would be a foreign key. So, a correct definition of foreign key would be: Foreign keys are the columns of a table that points to the candidate key of another table.
Leave a Reply