So, I have seen several references to the surrogate key recently, and I'm not quite sure what it is and how it differs from the primary key.
I always assumed that the identifier was my primary key in a table like this:
Users
ID, Guid
FirstName, Text
LastName, Text
SSN, Int
however, wikipedia defines a surrogate key as "A surrogate key in a database is a unique identifier for an object in the simulated world or an object in a database. The surrogate key is not obtained from the application data."
According to Wikipedia, does it look like the ID is my surrogate key, and my primary key could be SSN + ID? It is right? Is this a bad desk design?
Assuming the design of the table sounds, would it be something like this bad for a table where the data had nothing unique about it?
LogEntry
ID, Guid
LogEntryID, Int [sql identity field +1 every time]
LogType, Int
Message, Text
source
share