8 ms·
> - Names should be stored as display_name, first_name, and last_name. No. “[…] refer people to this post the next time they suggest a genius idea like a data
by teddyh 7y ago
> - Names should be stored as display_name, first_name, and last_name.
No.
“[…] refer people to this post the next time they suggest a genius idea like a database table with a first_name and last_name column.”
— https://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/ https://www.kalzumeus.com/2010/06/17/falsehoods-programmers-...
You could, conceivably, have a "display_name" column, an "informal_name" column, a "formal_name" column, etc. depending on your needs. But for absolutely most people and purposes, a single "name" column will suffice, and will steer programmers away from making unfounded assumptions about people’s names.
- NOGDP 7y agoFrom the article: > This list is by no means exhaustive. If you need examples of real names which disprove any of the above commonly held misconceptions, I will happily introduce you to several. ... > 40. People have names.
- jayd16 7y agoSome oauth systems will give you a user id or an email but not permission to see a name, for example.
- zimpenfish 7y agoPrince, famously, didn't have what we'd recognise as a name for years. All the "Unknown Soldier"s don't have names. "John/Jane Doe" doesn't technically have a name.
- goto11 7y agoThese examples seem somewhat contrived, but of course it comes down to the use case of the database. I'm sure Prince remained registered under his legal name on contracts, checks etc, even if he used the symbol in marketing. But a database over bodies in a morgue obviously need to be able to support unidentified bodies.
- MaxBarraclough 7y agoInteresting, I think you're right. According to Wikipedia, he only changed his stage name, not his legal name. The BBC didn't seem to make the distinction. https://en.wikipedia.org/wiki/Prince_(musician) https://en.wikipedia.org/wiki/Prince_(musician) , https://www.bbc.co.uk/news/magazine-36107590 https://www.bbc.co.uk/news/magazine-36107590
- humanrebar 7y agoNewborns have no known names until the birth certificate is filled out. There is still data about their medical care that needs stored in a database.
- tasogare 7y agoAlso for international users browsing in English labeling the fields "given name" and "family name" are way more clearer than using first and last names.
- rumanator 7y agoAlso, in some cultures like in Spain the legal surname is typically the first family name, which might be the first of two or three family names.
- pezezin 7y agoWhat do you mean "the legal surname"? I'm Spanish and my legal name is my full name with both family names. You can't just ignore one. Also, Spanish people have two family names, but they can be composite, so they may look as three or four family names. However, most people are usually known by one family name, but which one is used depends on which one is more easily recognizable.
- rumanator 7y ago> What do you mean "the legal surname"? I'm Spanish and my legal name is my full name with both family names. I'm referring to the primer apellido. Even government forms require that people break down their surnames in first surname and all trailing surnames.
- Wildgoose 7y agoExactly what I was thinking - plus a field to state the order they should be displayed in seeing as Asian cultures usually state the Family Name first.
- pezezin 7y agoShouldn't that be a localization/translation issue? My experience living in Japan is that they will write family name first if using Japanese, but given name first if using an European language.
- codr7 7y agoI spent 13 years maintaining a large-ish system that separated first- and last names for customers. Separating makes searching/indexing on last name easier. The alternative would be to put last names first by convention, which renders them unusable for anything else; or go insane trying to find a universal way of splitting and recombining for display. Keeping them separate inevitably results in a convention to put company names in the last name field for corporations, and failed searches when the convention is broken. It's one of those questions that I suspect will keep bugging me until I die.
- henrikschroder 7y ago> Separating makes searching/indexing on last name easier. What do you mean "last name"? If you have two last names, then what? If you have no last name, then what? > Keeping them separate inevitably results in a convention to put company names in the last name field for corporations If you only have a single field for name, this problem disappears.
- codr7 7y agoI mean everything but the first name. Yes, but then you have to deal with the indexing/search problem instead.
- henrikschroder 7y agoYeah, but if you only have one last name field, you can only index on people's first last name, not their second last name? How are you going to solve that?
- naasking 7y ago> Separating makes searching/indexing on last name easier. The point is that such a search or index is a mistake. It's simply not meaningful based on the real properties of names, it just happens to work 99% of the time if you're only dealing with a mostly homogenous culture.
- 7y ago
- Mikhail_Edoshin 7y agoYou'll regret this decision as soon as you have to integrate with another system that uses separate first and last names. Or as soon as you want to build a sorted list of five thousand names or output a bibliography in a specific format or anything. Technically the right approach to the problem of storing international names would be to store markup: a string with an associated structure and a discriminant: <name lang="en"> <first>Kenneth</first> <middle>Elton</middle> <last>Kesey</last> </name> <name lang="ru"> <given>Fyodor</given> <patronymic>Mikhailovich</patronymic> <surname>Dostoyevsky</surname> </name> <name lang="es"> <given>Gabriel</given> <family-paternal>García</family> <family-maternal>Márquez</family> </name> You can then have precise automated ways to transform this into whatever derived form you need. Using a single name field is just avoiding the problem. Using multiple fields is a maintenance burden, because in most cases fields are not fully independent and you have to update them all to keep the data coherent.
- goto11 7y agoUsing markup does not really change anything, that is just a way of serializing a data structure. You can represent the same information in normalized form.
- Mikhail_Edoshin 7y agoOf course, I don't mean storing literal XML, but I think it's important to support generic markup in databases. It's not that hard, after all; something like these five tables: Markup (markupId, string) Ns (nsId, uri) QName (qNameId, nsId, localName) Elt (markupId, eltId, qNameId, start, length /* string indices */, level, index /* or other way to represent hierarchy */ ) Attr (eltId, qNameId, value) would be enough to store and fully index any XML out there. I think markup is an important separate data type. We have records, we have scalars, now we have a hybrid type, markup: a string (or maybe a byte/bit stream) + records linked to indexes in this string/stream and maybe forming a hierarchy.
- eecc 7y ago
- MaxBarraclough 7y agoBut then you don't have my informal name. When I receive an informal update email, it would be clunky to have it begin Dear Max Barraclough. You can't automatically deduce that the way to address me informally is Max, without making assumptions that will break outside the English speaking world. See Points 18, 24, and 30. The W3C suggest that one way to handle names is to have a Full name field and a What should we call you? field. https://www.w3.org/International/questions/qa-personal-names https://www.w3.org/International/questions/qa-personal-names
- marcosdumay 7y agoIf the database owner is not billing you, he probably doesn't need your formal name, so he can have just one column, and call it "name". Otherwise, yes, he'll need the 2 columns.
- ddrt 7y agoHow do you store addresses? There’s a use case for breaking things up.
- henrikschroder 7y agoIf I had a dime for address forms that have "state" as a mandatory field, while having a country dropdown that contains countries that do not have states, I'd be rich, RICH I TELL YOU!