News for hackers. Stuff that matters.
Re:What does First Normal Form mean? by dylan604 on Friday June 18, 2021 @11:55AM (#27551675)
How would DoB work as a primary key? A primary key is useless if not unique, right? And I know many people born on the same day that aren't even twins. Incrementing integers are nice and easy for humans to consume. Using GUIDs is far more portable than unique integers, but damn near impossible for humans to deal.
Re:What does First Normal Form mean? by whatshisface on Friday June 18, 2021 @12:18PM (#27551930)
They wouldn't, so my point is why do RDBMSs support so many kinds of primary keys?
Re:What does First Normal Form mean? by dylan604 on Friday June 18, 2021 @12:25PM (#27552003)
Keys can span multiple columns, so DoB could be a differentiator if First, Last are also the same. I personally would never try to build a key like that though, but that's the only way I could see justifying its use.

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

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.
Re:What does First Normal Form mean? by ipaddr on Friday June 18, 2021 @10:40PM (#27557273)
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.

Re:What does First Normal Form mean? by brantam on Friday June 18, 2021 @11:54PM (#27557603)
> 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.

Re:What does First Normal Form mean? by dylan604 on Friday June 18, 2021 @01:22PM (#27552670)
Not sure exactly what you mean by non-arbitrary primary key, but...

GUID/UUID

FeatureName/ReleaseYear or Series/Season/Episode

email

phone-number

SSN

driverslicense#/State