0
  1. What exactly is a surrogate primary key?
  2. Is a surrogate primary key just a made up attribute inserted into a table by the database administrator?

All I know is that you use a surrogate key when there is no primary key or the natural key may not be a suitable primary key.

2
Contributors
1
Reply
11
Views
3 Years
Discussion Span
Last Post by hericles
1

You pretty much have it correct. If no data lends itself to being a natural key (i.e. nothing int the data is unique across rows) a surrogate key needs to be supplied.
If you created a id column using [int auto_increment primary key] then you have a surrogate key because, although the column uniqiuely identifies each row, it has no real world realtionship with the data.
Using unique 'business' data means you are using a natural key e.g. social security numbers in a payroll database

Votes + Comments
Thankyou sir
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.