Mike Yearwood
Toronto, Ontario, Canada
Information générale
Forum:
Microsoft SQL Server
>>Just as having int be the PK type everywhere as a standard is a good thing, so is having meaningless keys as a standard. The point to them is to prevent any kind of cascade updates. You have an invoice number on the invoice header. You have a meaningless key on the invoice header. You use that key to join to line items. The invoice number can be changed all you want with no effect on the line items.
>
>Wrong example - any accountant or auditor will frown at changing an invoice number - but the logic here is correct.
When computerizing a manual system, one where the key is not generated, but entered by hand, it can be necessary to edit it after a mistake by a user.
>For instance, one would be insane to make a house number part of any important key, as streets may undergo renumbering. Or the passport number example - it is maybe a good PK for the passport, but not for a person, as passports expire. Etc etc. An invisible PK is not changing ever, simply because it's not doing any sidejob, it's just a key.
Other than that, I agree. A key is just a key and should not be used as meaningful data.
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement