The primary key and the surrogate key both are unique identifiers for the entity in the modelled world or object in the database. However , they have a difference which is based on the type of the database being used.
Primary Key | Surrogate Key |
---|---|
Primary Key is a constraint that ensures that the column or set of columns so designated should not have duplicate or null values . | Surrogate Key is a column or set of colums that can be declared as primary key instead of a natural or real key. |