3 ms·
Natural keys are everywhere. They are just less interesting than the relationships. My name is a natural key. It uniquely identifies my name. The wheels com
by mulmen 5y ago
Natural keys are everywhere. They are just less interesting than the relationships. My name is a natural key. It uniquely identifies my name. The wheels come off if you expect it to uniquely identify me. But with natural keys that's never actually necessary.
When I buy a car they record my name, my date of birth, the time of the sale and some details about the car, such as the VIN, which is its name. That provides enough information to form a natural key to identify the sale.
At no point does a database actually have a concept of who I am really, only the relevant data points to satisfy its own relational model.
Any database that means to track information about people would be able to construct a natural key from my name, my mothers name and some information about my birth, such as the doctor, hospital and time.
- jameshart 5y ago(Interesting cultural assumption there that people are born in hospitals under the supervision of doctors) The thing is to qualify as a natural key I think it has to be precisely recoverable just from first principles wherever you encounter the artifact it references. The birth details aren’t inherent to the person, they’re datapoints about them. All the identifiers you propose to make up mnatural’ keys are synthetic keys from some other authority for identifying things. VINs obviously are synthetic identifiers, but so are names, dates, hospital addresses. As you rightly say, a string is a natural key for itself; likewise a number. The only other ‘natural key’ I can think of is atomic number for identifying chemical elements.
- mulmen 5y agoI said a database that tracks people could identify me using information about my birth. Not that everyone is born in a hospital or by a doctor. By your definition there are no natural keys. But since that definition isn't useful we instead use one that is. The natural key is the identifier by which the thing is already known. https://en.wikipedia.org/wiki/Natural_key https://en.wikipedia.org/wiki/Natural_key
- CRConrad 5y ago> I said a database that tracks people could identify me using information about my birth. And your name, you said. > The natural key is the identifier by which the thing is already known. And then you change your name.
- denton-scratch 5y agoProbably not unique, though. Well, yours might be; but in general, a person's name isn't a reliable unique identifier. Nor anyone's name. Even if you have a timestramp, you can't be sure it's unique.