Foreign key is used to setup relation between two tables in a database. A foreign key is a values that appear in both the tables in database system.
The table which contain foreign key is called the child table while the table to which foreign key is referred is called parent table. Foreign key mainly reference a primary key in the parent table.
we can create a foreign key by using a CREATE TABLE statement or by ALTER TABLE statement.
Below is the syntax for creating a foreign key by an CREATE TABLE statement :-