The differences between these two keys are mentioned below:
-The primary key uniquely identifies a record, whereas foreign key refers to the primary key of another table.
-The primary key can never accept a NULL value but foreign key accepts a NULL value.
-When a record is inserted in a table that contains the primary key then it is not necessary to insert the value on the table that contains this primary key field as the foreign key.
-When a record is deleted from the table that contains the primary key then the corresponding record must be deleted from the table containing the foreign key for data consistency.
-But any record can be deleted from the table that contains a foreign key without deleting a related record of another table.
Read More →