A Foreign Key creates a link between tables. It references the primary key in another table and links it.
For example, the DeptID in the Employee table is a foreign key −
The DeptID in the Department table is a Primary Key in the Department Table.
The DeptID in the Employee table is a Foreign Key in the Employee Table.
The below figure represents the same −
Above, you can see our two tables. The Foreign Key of the Employee table is the Primary Key of the Department table.