Foreign key
When a primary key of one table appears as an attribute in another table it is known as the foreign key in the second table. A foreign key is used to associate two tables.
Let consider the tables, staff and department.
Department
Staff
Because deptcode is unique in the department table, you can choose deptcode as a primary key. While it apperas in the staff table as an attribute it will be the foreign key in the staff table. You must ensure in which the values of the foreign key match with any one value of the primary key.
You can use the subsequent conventions to represent the keys in the table structure by.
Foreign key –Fk
Primary key– Pk