From the course: Database Foundations: Data Structures

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Surrogate keys

Surrogate keys

From the course: Database Foundations: Data Structures

Start my 1-month free trial

Surrogate keys

- [Instructor] If there aren't any good candidates for naturally occurring primary keys or composite primary keys already present in your data, then you have no choice but to create a new column that contains new made up values pulled out of thin air. These are called surrogate keys. The values stored in a surrogate primary key column have no real world meaning. Their entire purpose is to create a unique column in a data table, and that's it. Typically, these take the form of an incrementing serial number or integer, but they can also use randomly generated values as well. If you think about your bank account number, then you'll have a good idea about what a surrogate key can look like. That number did not exist in the bank's records until you opened your account. Then they generated your unique bank account number and assigned it to you. No other customer will get the same number and that number doesn't have any other…

Contents