Monday, October 22, 2012

Differences between Primary Key and Foreign Key

Differences between Primary Key and Foreign Key

The main diference between primary key and the foreign key is that the primary key is a column or a set of columns that can be used to uniquely identify a row in a table while the foreign key is a column or a set of columns that refer to a primary key or a candidate key of another table.


Foreign key mainly provides a method to link information in several tables. Another difference is that a table can have a single primary key, but it can have multiple foreign keys that can reference different tables.

No comments:

Post a Comment