Re:What does First Normal Form mean?
by whatshisface on Friday June 18, 2021 @12:28PM
(#27552058)
Can you think of any good use case for a non-arbitrary primary key? You are right that first name + last name + dob is not a good way to design the system. For example someone could differentiate their twin children only by their middle name. So, what's an example of a non-integer non-arbitrary primary key?
Re:What does First Normal Form mean?
by bart_spoon on Friday June 18, 2021 @07:39PM
(#27556293)
I stated this elsewhere, but with some sports data, you don’t gain anything with a uniquely generated game ID. NBA teams will only play one game at most per day, and only play one other team, so if you make a key of the date and the teams playing, you uniquely identify every event. You can create an arbitrary ID for a game if you want, but it’s not actually giving you information you don’t have, and therefore is entirely redundant.
Using a generated pagename as a key.
You create a cms. You store each page with a 16 character name as the key and you use that as the url/pagename.
What about storing the ip for login attempts. You store the ip and date and use that information to rate limit. The ip is the primary id.
Password reset, you store the unique code you sent in the email as the key.
Country codes. The 2 or 3 short name makes as a key over a number if you want to limit joins.
Bitcoin key.
Anything token, key related, anywhere where you want to enforce no duplicates like a ssn.
> Can you think of any good use case for a non-arbitrary primary key?
Login names; Vehicle registration numbers; flight numbers; domain names; file names; ip addresses. Keys are used in those cases where the enforcement of uniqueness is important for data integrity and identification purposes.
If you can't see a why for uses of a field that is truly more unique, then I'd suggest you just need some more imagination. Strictly not allowing it seems to me to be short sighted just because someone had the ill conceived idea to use DoB as a primary key