3 ms·
What about people with the same birthdays?
by cyberbanjo 5y ago
What about people with the same birthdays?
- wfriesen 5y agoBusiness/requirements/users will often tell you that no two users will have the same birthday/SSN/whatever, but so often that eventually proves incorrect. Just using an auto increment ID as the primary key can prevent a lot of pain down the road.
- lifepillar 5y agoSo, when someone comes to you and identifies herself by providing her SSN, name, date of birth, how do you know whether she corresponds to the record with id M or to the record with id N? Or, more likely, to one of the N records, with N>2, with that SSN, name, date of birth?
- jraph 5y agoWhat about them? Do they really exist, practically speaking? At a quick glance on my databases, I see nothing of the sort.
- lkuty 5y agohttps://en.wikipedia.org/wiki/Birthday_problem https://en.wikipedia.org/wiki/Birthday_problem
- jraph 5y agoIs there anything comparable to the birthday paradox, which includes years, by the way? I would guess that you would need a big group of random people such that there is a high chance of having two people born the very same day.
- whatshisface 5y agoThe birthday paradox threshold if years are included would be 23 people per year, rather than 23 people in your database. What that translates to in your database depends a lot the age demography of your userbase. If people live to be 100, and if I don't worry about the fact that some years will have more people than others even if they are randomly distributed (something that should go in to the model), that's about 2,300 people before you start expecting to see duplicate birthdays.
- cyberbanjo 5y agoI don't think the birthday problem accounts for year, but yet it's clear some people share the same birthdate, twins for example.
- jcranmer 5y agoI share the same name and birthdate as another individual. It has actually caused me to be held up at the border before.
- Kranar 5y agoAre we seriously discussing whether in practice, two people can be born on the same day?
- jraph 5y agoThis was an absurd joke. A person looking at their database using birth dates as a primary key can obviously only see people with different birth dates.
- ARandomerDude 5y agoI think this was the parent's point. Since, as you point out, we we almost never use the data itself (e.g. date of birth) as the primary key, the parent is asking why is this a feature at all? Why not just mandate a uuid, number, etc. as the primary key?
- uDontKnowMe 5y agoWell it's easy enough to think of a situation where you would use a date as a primary key, for example time series data.