Categories
Sql Server

Difference Between Primary Key and Foreign Key

Difference Between Primary Key and Foreign Key

In this post we will see the Difference Between Primary Key and Foreign Key.Primary key and foreign key which seems to be identical, but they are different in features and behavior.We already discussed on our earlier post about Primary key & Foreign Key.

Difference between Primary key and Foreign key:

Primary Key Foreign Key
 It does not allow any null value or duplicate value. Foreign key can accept multiple null value.
 Primary key is used to uniquely identify the each record from table. Foreign key is a field in the table that is primary key in another table.
 Primary key is clustered index. Foreign key is not an index.
 We can have only one Primary key in a table. We can have more then one Foreign key in a table.