4 ms·
> Never store firstname and lastname in the same field funny, where would you store the middle name then? and the second middle name? married name in cultures
by LoSboccacc 7y ago
> Never store firstname and lastname in the same field
funny, where would you store the middle name then? and the second middle name? married name in cultures where the spouse changes or double it? of course in normal form you need a name table, with an order column, and so on and so long.
anyway, this article goes straight to the notions everyone can fetch on any book and skip the interesting and diffiylcult part about database design, which is understanding your domain so that no future expansion is prevented by a wrong cardinality on a relation that was simplified from reality.
because if it's a user database you might get away with just the name, so you can address people during support calls. if it's an accounting database, you might want to know someone name at the time of invoicing, having multiple records with start and end validity times, and if it's a FBI database for protected identities you might have to have multiple name aliases referring to a single person.
- helloiloveyou 7y agoI'd store the middle name in the first_name column. Like for example "Juan Martin" would be in the first_name columns and "Del Potro" in the last_name. Apart from the middle/first name incongruence that you may highlight, I believe that this design is not awfully bad and should serve in most situations.
- jimktrains2 7y agoIf you used that as an address in emails it'd sound very awkward to include a middle name when someone doesn't usually go by it.
- earthboundkid 7y agoMany Americans have two word first names like “Sue Ellen” or “Mary Anna” as well as a middle name. Double last names are even more common.
- LoSboccacc 7y agowhy on earth would you, and the article writer for that matter, use a column named first_name for storing the middle names as well? just call it name! as I said above, the article goes to length about normal form, and skimps on the important part: the data model is a representation of the real world, and a first_name column with middle names inside is basically a straight up lie of what the column models and what data it contains. there's not one way to represent names, there are application specific domain where generalities need to be more or less detailed, but the core aspect of it all is that the data model shouldn't lie about what it is that it's modelling.