名字,中间名,姓。为什么不的全名吗?

时间:2022-04-28 08:33:08

I am trying to find a better approach for storing people's name in the table. What is the benefits of 3 field over 1 field for storing persons name?

我正在寻找一种更好的方法将人们的名字存储在表中。3个字段比1个字段存储人名有什么好处?

UPDATE

更新

Here is an interesting discussion and resources about storing names and user experience

这里有一个关于存储名称和用户体验的有趣的讨论和资源

Merging firstname/last name into one field

将firstname/last name合并到一个字段中

22 个解决方案

#1


33  

Keep your data as clean as you can!

尽可能保持你的数据干净!

How?

如何?

Ask your user only as few things as you absolutely need at the time you ask.

当你问的时候,只问你的用户最需要的东西。

How you store the name does not matter. What does matter is that

如何存储名称并不重要。这有什么关系呢

  1. the user experience is as good as can be
  2. 用户体验是最好的
  3. you don't have false data in your system
  4. 您的系统中没有错误的数据

If you annoy the users with mandatory fields to fill in and re-question them several times, they can get upset and not buy into your application right there and then. You want to avoid bad user experiences at all times.

如果你用强制的字段骚扰用户多次,他们可能会心烦意乱,而不会在你的应用程序中购买。你想要在任何时候都避免糟糕的用户体验。

No user cares how easy it is for you to search your database for his middle name. He wants to have a easy, feel good experience, that's it.

没有一个用户会关心你在数据库中搜索他的中间名有多容易。他想要轻松,感觉良好,就这样。

What do users do if they are forced to input data like their postal address, or even email address when they only want a "read-only" account with no notifications needed? They put garbage data into your system. This will render your super search and sort algorithms useless anyway.

如果用户只需要一个“只读”账户而不需要任何通知,那么如果他们*输入自己的邮政地址,甚至是电子邮件地址,用户该怎么办?他们把垃圾数据输入你的系统。这将使你的超级搜索和排序算法变得毫无用处。

Thus, my advice would be in any app to gather just as little information from your user as you really need in order to serve them, no more.

因此,我的建议是在任何应用程序中收集尽可能少的用户信息,以便为他们服务,而不是更多。

If for example you run a online shop for pet food, don't ask your users at sign-up what kind of pets they own. Make it an option for them to fill in once they are logged in and all happy (new customers). Don't ask them their postal address until they order stuff that is actually carried to their house, stuff they pay for and thus care that YOU have their exact coordinates.

例如,如果你经营一家宠物食品的网上商店,不要在注册时问你的用户他们拥有什么样的宠物。让它成为一个选项,让他们在登录后填写,并且所有人都满意(新客户)。不要问他们的邮政地址,直到他们点了一些实际被送到他们家里的东西,他们付钱买的东西,这样你才会知道他们的确切坐标。

This will lead to a lot better data quality and this is what you should care about, not technical details the user has no benefit from....

这将导致数据质量好得多,这是你应该关心的,而不是技术细节用户没有受益于....

In your example I would just ask for the full name (not sure though) and once the user willingly subscribes to your newsletter, let the user decide how he/she wants to be addressed...

在您的示例中,我只需要询问全名(尽管不确定),一旦用户愿意订阅您的通讯,让用户决定如何称呼他/她……

#2


65  

You can always construct a full name from its components, but you can't always deconstruct a full name into its components.

您总是可以从它的组件构造一个全名,但是不能总是将一个全名分解到它的组件中。

Say you want to write an email starting with "Dear Richie" - you can do that trivially if you have a given_name field, but figuring out what someone's given name is from their full name isn't trivial.

假设你想写一封以“亲爱的里奇”开头的电子邮件——如果你有一个given_name字段,你可以这样做,但是从某人的全名中找出他的名字并不是一件小事。

You can also trivially search or sort by given_name, or family_name, or whatever.

您还可以通过given_name、family_name或其他方式进行简单的搜索或排序。

(Note I'm using given_name, family_name, etc. rather than first_name, last_name, because different cultures put their names in different orders.)

(注意,我使用的是given_name、family_name等,而不是first_name、last_name,因为不同的文化把它们的名称按不同的顺序排列。)

Solving this problem in the general case is hard - here's an article that gives a flavour of how hard it is: Representing People's Names in Dublin Core.

在一般情况下要解决这个问题是很困难的——这里有一篇文章描述了这有多难:在都柏林核心代表人们的名字。

#3


16  

As others have said, how do you decompose a full name in to its component parts.

正如其他人所说,如何将全名分解到它的组成部分。

  • Colin Angus Mackay
  • 科林·安格斯麦凯
  • Jean Michel Jarre
  • Jean Michel贾尔
  • Vincent van Gogh
  • 文森特·梵高
  • Pablo Diego José Francisco de Paula Juan Nepomuceno María de los Remedios Cipriano de la Santísima Trinidad Ruiz y Picasso
  • 巴勃罗·迭戈·乔斯·弗朗西斯科·德·波拉·胡安·内波莫纳·玛丽亚·德·洛斯·雷麦黛丝·德·拉桑蒂西马·特立尼达·鲁伊斯和毕加索

How do you reliably decompose that lot?

如何可靠地分解这些物质?

To learn more, see falsehoods programmers believe about names.

要了解更多信息,请参见程序员相信名称。

#4


12  

I was looking up the Spanish Civil War the other day, and found this exception to most rules:

前几天我查了西班牙内战,发现大多数规则都有例外:

  • Francisco Paulino Hermenegildo Teódulo Franco y Bahamonde, Salgado y Pardo de Andrade
  • 弗朗西斯科·波利诺·赫尔梅尼吉尔多·图罗·佛朗哥·巴哈蒙德,萨尔加多·帕尔多·德·安德拉德
  • Father: Nicolás Franco y Salgado-Araújo
  • 父亲:尼古拉斯·弗朗哥·萨尔加多·阿劳霍
  • Mother: María del Pilar Bahamonde y Pardo de Andrade
  • 母亲:玛丽亚·德尔·皮拉尔·巴哈蒙德和安德拉德

Next time I'm working on a system that has to store names, I'm going to try something radical: designing from the requirements.

下一次,当我研究一个必须存储名称的系统时,我将尝试一些根本的东西:根据需求进行设计。

What are we going to use the names for?

我们要用这些名字做什么?

  1. Name on an address label for the postal service
  2. 在邮政服务的地址标签上的名字
  3. Greeting on the website
  4. 问候在网站上
  5. Informal name
  6. 非正式的名字

Based on what the names will be used for, we'd determine how much information to store. Maybe we allow the user to enter all three of those, including line breaks in the first case (Generalissimo Franco might want his full titles and appointments listed, if he weren't still dead). Maybe we provide First, Middle, Last, Generation as an option, and fill in the rest as defaults. Maybe we offer other common options like Surname, Given Name.

根据名称的用途,我们将确定要存储多少信息。也许我们允许用户输入这三种内容,包括第一种情况下的换行符(如果不是死的话,总司令弗兰科可能希望列出他的全部头衔和约会)。也许我们可以提供First、Middle、Last代作为选项,并以默认方式填充其余的代。也许我们可以提供其他常见的选择,比如姓,名。

This is in contrast to the old-style First, Middle, Last we've used since before I started programming in COBOL back in 1975, and have "made fit" ever since.

这与我们在1975年开始使用COBOL编程之前使用的老式的第一种、中间的、最后的方式形成了对比,从那时起就开始使用“make fit”。

#5


11  

Unfortunately this is kind of like asking what is the best way to store a number in the database. It depends on what you are going to do with it - sometimes you want an int,other times a byte, and sometimes a float. With names it depends on things like what cultures do you expect your users to come from, what you plan on doing with the names (will you be using these names to connect with another system that stores names as "last name, first name"?), and how much you can afford to annoy your users. If this is an internal HR application, you can probably afford to annoy the users a lot, and have a very structured, formal breakdown of name components (there are way more than 3 - don't forget mr/mrs, jr, III, multiple middle names, hyphenated last names, and who knows what else if you are trying to handle names from all cultures. If you have a webapp that users might or might not care about, you can't ask them to care too much.

不幸的是,这有点像问在数据库中存储数字的最佳方式是什么。它取决于你要用它做什么——有时你想要一个int,有时是一个字节,有时是一个浮点数。名字它取决于你希望用户来自什么文化,你打算做什么姓名(你会使用这些名称连接与另一个系统,商店名称“姓、名字”?),多少你可以惹恼用户。如果这是一个内部人力资源应用程序中,您可能会承受骚扰用户很多,和有一个非常结构化,正式的名称组件(分解方法有超过3 -不要忘记先生/夫人,jr,三世,多个中间的名字,最后用连字符连接的名字,谁知道还有什么如果你想处理的名字从所有的文化。如果你有一个用户可能关心或不关心的webapp,你不能要求他们太在意。

#6


7  

You may want to search on the 3 separate fields for one and its inexpensive to concatenate for the fullname.

您可能想要在3个独立字段中搜索一个,而将全称连接起来并不昂贵。

e.g. If you want to search for all the Mr. Nolans your query would be

如果你想搜索所有的诺兰先生,你的问题就是

SELECT Title+' '+FirstName+' '+Surname As FullName  
from table where firstname = 'Mr' and surname ='Nolan'

to do this with just the fullnames would be a pain.

用全名来做这件事会很痛苦。

#7


4  

Keeping the fields separate allows you to support different output formats and cultures where the family name is written first

保持字段独立允许您支持不同的输出格式和区域性,在这些格式和区域性中,家族名称首先被写入

#8


4  

Things like ORDER BY firstname or ORDER BY lastname are possible when you break the name up into multiple fields.

当您将名称分割为多个字段时,像按名排序或按姓排序这样的事情是可能的。

Not as easy to do when you mash all names into one field.

当你把所有的名字都混在一起的时候,做起来就不那么容易了。

#9


4  

I'm English and only have one name. I normally put it in the 'surname' field for least aggravation. I am usually forced to put something in the 'first name' field too, which by definition is wrong.

我是英国人,只有一个名字。我通常会把它放在“姓”栏里,以免加重。我通常也会*在“名字”字段中输入一些东西,这在定义上是错误的。

Any attempt to impose anything more than 'Name' is doomed to be wrong at least some of the time, and sometimes be very frustrating to users. Single names are common in Southern India, Indonesia, and Pakistan (which is hundreds of millions of people) as well as the occaisional weirdo on the UK like me.

任何企图强加任何超过“名称”的东西都注定是错误的,至少在某些时候是错误的,有时会让用户非常沮丧。在印度南部、印度尼西亚和巴基斯坦(有数亿人口),以及像我这样的英国人,名字都很常见。

The 'first, middle, last' thing is very U.S.-centric. Few other countries think of names that way. Please stop doing it.

“第一,中间,最后”的东西是以美国为中心的。很少有其他国家这么想名字。请停止这样做。

#10


2  

About the only thing I can think of is for searching purposes. It's a bit better to search a field using [=] rather than say [like].

我能想到的唯一一件事就是为了搜索。使用[=]搜索字段比使用[like]要好一点。

If you have no need to display the name as seperate words then go with a single field.

如果您不需要将名称显示为独立的单词,则使用单个字段。

But if you need to do something like [Dear Mr. Achu] then perhaps a 3 field approach would be better.

但如果你需要做一些类似的事情(亲爱的阿楚先生),也许3领域的方法会更好。

#11


2  

Most of the time it's there to support writing form letters like, "Mr. so-and-so", or to search/sort by last name which is very common.

大多数情况下,它支持书写像“某某先生”这样的字母,或者按姓搜索/排序,这是很常见的。

Given that first/middle/last may not apply to all cultures, there could be a better approach. It might be better expressed as "informal name" / "formal name" / "legal name" or something like that.

考虑到第一/中/最后可能不适用于所有的文化,可能会有更好的方法。它可以更好地表示为“非正式名称”/“正式名称”/“法定名称”或类似的东西。

Still, at this point first/middle/last is very common, and from a data entry standpoint it is what everyone expect.

不过,在这一点上,first/middle/last是非常常见的,从数据输入的角度来看,这是每个人都希望看到的。

#12


2  

Here's the thing, not even humans can get this right all the time, there's just too much data, and too many special cases. I could change my name right now to be 20 parts, with the middle 13 as my "first" name. Parts of names can contain any number of words, and there can be any number of parts of names. Some people only have 1 name (no surname). Some people have lots of middle names. Some people have first or surnames composed of several words. Some people list their surname first. Some people go by their middle name. Some people go by nicknames that aren't obviously related to their given name.

事情是这样的,即使是人类也不可能一直做对,有太多的数据和太多的特殊情况。我现在可以把我的名字改为20个部分,中间13是我的“第一个”名字。名字的部分可以包含任意数量的单词,也可以包含任意数量的名字。有些人只有一个名字(没有姓)。有些人有很多中间名。有些人的名字或姓氏由几个词组成。有些人先说出自己的姓。有些人用中间名。有些人的昵称与他们的名字没有明显的联系。

If you try to guess these conventions in software YOU WILL FAIL. Period. Maybe you'll get it right some of the time, maybe even most of the time, but is even that worth it? In my opinion you should store names as one field and stop trying to be cute by using first names to refer to a person. If you need additional information about a name (e.g. a nickname), ask the user!

如果你试图在软件中猜测这些惯例,你将会失败。时期。也许你有时会做对,甚至大多数时候也会做对,但这值得吗?在我看来,你应该把名字存储在一个字段中,不要用名字来指代一个人,这样会显得很可爱。如果你需要关于一个名字的额外信息(例如一个昵称),问问用户!

#13


1  

Each of the individual names is an atomic piece of data. When they are stored separately then it is easier to print them out in different formats such as Firstname Lastname and Lastname, Firstname.

每个单独的名称都是数据的一个原子部分。当它们分开存储时,就可以更容易地以不同的格式打印出来,如Firstname Lastname和Lastname、Firstname。

#14


1  

There is no benefit if you never need to sort or search by first, middle, or last name.

如果您永远不需要按第一、中间或姓排序或搜索,那么就没有任何好处。

#15


1  

Flexibility.

的灵活性。

e.g. If someone had a double barreled last name and no middle name.

如果有人的姓是双管的,没有中间名。

#16


1  

I voted up some of these answers, but if you are looking to avoid repetitive or redundant or messy concatenation in your code, you can always use a computed column in the database or a method in a class which exposes the name consistently reconstructed. If these concatenations are expensive (because you are printing a million statements), you can use a persisted column.

我对其中的一些答案进行了投票,但是如果您希望避免代码中的重复、冗余或混乱的连接,那么您总是可以在数据库中使用计算列,或者在公开名称的类中使用一贯重构的方法。如果这些连接非常昂贵(因为要打印一百万条语句),那么可以使用持久化列。

Often you will allow users to specify names like nicknames or friendly names, so that you aren't referring to them by the name in their records or always as Mr. Smith.

通常,你会允许用户指定名字,比如昵称或友好的名字,这样你就不会在他们的记录中引用他们的名字,也不会一直用史密斯先生的名字。

It all depends on your requirements. There is no single good answer without the environment it is expected to satisfy.

这完全取决于你的要求。没有它所期望的环境,就没有一个好的答案。

#17


1  

Not sure how practical it would be, but maybe if cultural sensitivity is important in the context of the application being developed, perhaps a name should be a collection with each element of the collection carrying a value indicating if the name is the addressable "first name" or the addressable "surname" and so on for "title" or anything else that needs to be identified. A name ID could be used to identify the order of the elements for re-composing the full name.

不知道是多么实用,但是如果文化敏感性是很重要的,所开发的应用程序的上下文中,也许一个名字应该是一个集合的每个元素集合携带一个值表示如果名称是可寻址的“名字”或可寻址的“姓”等等“标题”或其他需要确认的东西。可以使用名称ID来标识重新组合全名的元素的顺序。

#18


1  

Just have two fields, 'Full Name', and 'Preferred Name' - easy. Supports every name in existance (As long as the language has lexical symbols... So, yes, that excludes languages that do not have a written form).

只有两个字段,“全名”和“首选姓名”——很简单。支持每个名字的存在(只要语言有词汇符号……所以,是的,这排除了没有书面形式的语言)。

Just make sure that they are handled in some unicode format, and that application code properly handles unicode conversion.

只需确保它们以某种unicode格式处理,并且应用程序代码正确处理unicode转换。

#19


0  

To me it is simply better to store 3 names so that explicit parsing is necessary later on if the individual components are needed..

对我来说,最好存储3个名称,以便在以后需要单个组件时需要进行显式解析。

#20


0  

You can't always separate surname from full name cleanly and reliably so there's good reason to separate that because you often need surname. After you do that, there are two common approaches:

你不可能总是干净可靠地把姓和全名分开,所以有充分的理由把它分开,因为你经常需要姓。在你这么做之后,有两种常见的方法:

  1. first_name and middle_name; or
  2. first_name和middle_name;或
  3. given_names.
  4. given_names。

(2) is arguably more preferable because people sometimes have more than tow given names and (1) is more inflexible in this regard.

(2)可以说更可取,因为人们有时有两个以上的名字,(1)在这方面更不灵活。

Also, another common field is preferred_name (in addition to the above).

另外,另一个公共字段是preferred_name(除了上面的字段)。

#21


0  

The i18n issue can be a bugger either way. certain cultures use the surname first and the given name last, that strikes the idea of first and last names so we move to fields for surnames and given names. Wait, some cultures don't have a surname or the surname is modified by the gender of the named.
We can get into tribal cultures where the person is renamed on adulthood. "Sitting Bull" childhood name was "Jumping Badger".
This is somewhat of a ramble but what I am showing is that the more fields you have the more accurate the design is. There should be at least a not null 'given name' field and a optional 'surname' field tied to a PK that is an integer. If the aforementioned requirements are observed, fields can be added without issues of breaking queries.

无论哪种情况,i18n问题都可能是个麻烦。某些文化使用姓名和名名名last,这与姓和名的概念相符,所以我们转到姓氏和名的字段。等等,有些文化没有姓,或者姓是根据名字的性别来修改的。我们可以进入部落文化,这个人在成年后被重新命名。“坐牛”儿时的名字是“跳獾”。这有点像漫步,但我所展示的是,你拥有越多的领域,设计就越精确。应该至少有一个非空的“给定名称”字段和一个可选的“姓”字段绑定到一个整数PK。如果遵守了上述要求,可以添加字段,而不存在中断查询的问题。

#22


0  

Some of the issues can be solved by also storing an additional column like PreferredName. We do that in our DB and also store prefix column and a suffix column. e.g 'Prof Henry W Jones Jnr' with preferred name as 'Indiana Jones'.

可以通过存储额外的列(如PreferredName)来解决一些问题。我们在DB中这样做,并存储前缀列和后缀列。e。“亨利·W·琼斯教授”,优选名字为“印第安纳·琼斯”。

#1


33  

Keep your data as clean as you can!

尽可能保持你的数据干净!

How?

如何?

Ask your user only as few things as you absolutely need at the time you ask.

当你问的时候,只问你的用户最需要的东西。

How you store the name does not matter. What does matter is that

如何存储名称并不重要。这有什么关系呢

  1. the user experience is as good as can be
  2. 用户体验是最好的
  3. you don't have false data in your system
  4. 您的系统中没有错误的数据

If you annoy the users with mandatory fields to fill in and re-question them several times, they can get upset and not buy into your application right there and then. You want to avoid bad user experiences at all times.

如果你用强制的字段骚扰用户多次,他们可能会心烦意乱,而不会在你的应用程序中购买。你想要在任何时候都避免糟糕的用户体验。

No user cares how easy it is for you to search your database for his middle name. He wants to have a easy, feel good experience, that's it.

没有一个用户会关心你在数据库中搜索他的中间名有多容易。他想要轻松,感觉良好,就这样。

What do users do if they are forced to input data like their postal address, or even email address when they only want a "read-only" account with no notifications needed? They put garbage data into your system. This will render your super search and sort algorithms useless anyway.

如果用户只需要一个“只读”账户而不需要任何通知,那么如果他们*输入自己的邮政地址,甚至是电子邮件地址,用户该怎么办?他们把垃圾数据输入你的系统。这将使你的超级搜索和排序算法变得毫无用处。

Thus, my advice would be in any app to gather just as little information from your user as you really need in order to serve them, no more.

因此,我的建议是在任何应用程序中收集尽可能少的用户信息,以便为他们服务,而不是更多。

If for example you run a online shop for pet food, don't ask your users at sign-up what kind of pets they own. Make it an option for them to fill in once they are logged in and all happy (new customers). Don't ask them their postal address until they order stuff that is actually carried to their house, stuff they pay for and thus care that YOU have their exact coordinates.

例如,如果你经营一家宠物食品的网上商店,不要在注册时问你的用户他们拥有什么样的宠物。让它成为一个选项,让他们在登录后填写,并且所有人都满意(新客户)。不要问他们的邮政地址,直到他们点了一些实际被送到他们家里的东西,他们付钱买的东西,这样你才会知道他们的确切坐标。

This will lead to a lot better data quality and this is what you should care about, not technical details the user has no benefit from....

这将导致数据质量好得多,这是你应该关心的,而不是技术细节用户没有受益于....

In your example I would just ask for the full name (not sure though) and once the user willingly subscribes to your newsletter, let the user decide how he/she wants to be addressed...

在您的示例中,我只需要询问全名(尽管不确定),一旦用户愿意订阅您的通讯,让用户决定如何称呼他/她……

#2


65  

You can always construct a full name from its components, but you can't always deconstruct a full name into its components.

您总是可以从它的组件构造一个全名,但是不能总是将一个全名分解到它的组件中。

Say you want to write an email starting with "Dear Richie" - you can do that trivially if you have a given_name field, but figuring out what someone's given name is from their full name isn't trivial.

假设你想写一封以“亲爱的里奇”开头的电子邮件——如果你有一个given_name字段,你可以这样做,但是从某人的全名中找出他的名字并不是一件小事。

You can also trivially search or sort by given_name, or family_name, or whatever.

您还可以通过given_name、family_name或其他方式进行简单的搜索或排序。

(Note I'm using given_name, family_name, etc. rather than first_name, last_name, because different cultures put their names in different orders.)

(注意,我使用的是given_name、family_name等,而不是first_name、last_name,因为不同的文化把它们的名称按不同的顺序排列。)

Solving this problem in the general case is hard - here's an article that gives a flavour of how hard it is: Representing People's Names in Dublin Core.

在一般情况下要解决这个问题是很困难的——这里有一篇文章描述了这有多难:在都柏林核心代表人们的名字。

#3


16  

As others have said, how do you decompose a full name in to its component parts.

正如其他人所说,如何将全名分解到它的组成部分。

  • Colin Angus Mackay
  • 科林·安格斯麦凯
  • Jean Michel Jarre
  • Jean Michel贾尔
  • Vincent van Gogh
  • 文森特·梵高
  • Pablo Diego José Francisco de Paula Juan Nepomuceno María de los Remedios Cipriano de la Santísima Trinidad Ruiz y Picasso
  • 巴勃罗·迭戈·乔斯·弗朗西斯科·德·波拉·胡安·内波莫纳·玛丽亚·德·洛斯·雷麦黛丝·德·拉桑蒂西马·特立尼达·鲁伊斯和毕加索

How do you reliably decompose that lot?

如何可靠地分解这些物质?

To learn more, see falsehoods programmers believe about names.

要了解更多信息,请参见程序员相信名称。

#4


12  

I was looking up the Spanish Civil War the other day, and found this exception to most rules:

前几天我查了西班牙内战,发现大多数规则都有例外:

  • Francisco Paulino Hermenegildo Teódulo Franco y Bahamonde, Salgado y Pardo de Andrade
  • 弗朗西斯科·波利诺·赫尔梅尼吉尔多·图罗·佛朗哥·巴哈蒙德,萨尔加多·帕尔多·德·安德拉德
  • Father: Nicolás Franco y Salgado-Araújo
  • 父亲:尼古拉斯·弗朗哥·萨尔加多·阿劳霍
  • Mother: María del Pilar Bahamonde y Pardo de Andrade
  • 母亲:玛丽亚·德尔·皮拉尔·巴哈蒙德和安德拉德

Next time I'm working on a system that has to store names, I'm going to try something radical: designing from the requirements.

下一次,当我研究一个必须存储名称的系统时,我将尝试一些根本的东西:根据需求进行设计。

What are we going to use the names for?

我们要用这些名字做什么?

  1. Name on an address label for the postal service
  2. 在邮政服务的地址标签上的名字
  3. Greeting on the website
  4. 问候在网站上
  5. Informal name
  6. 非正式的名字

Based on what the names will be used for, we'd determine how much information to store. Maybe we allow the user to enter all three of those, including line breaks in the first case (Generalissimo Franco might want his full titles and appointments listed, if he weren't still dead). Maybe we provide First, Middle, Last, Generation as an option, and fill in the rest as defaults. Maybe we offer other common options like Surname, Given Name.

根据名称的用途,我们将确定要存储多少信息。也许我们允许用户输入这三种内容,包括第一种情况下的换行符(如果不是死的话,总司令弗兰科可能希望列出他的全部头衔和约会)。也许我们可以提供First、Middle、Last代作为选项,并以默认方式填充其余的代。也许我们可以提供其他常见的选择,比如姓,名。

This is in contrast to the old-style First, Middle, Last we've used since before I started programming in COBOL back in 1975, and have "made fit" ever since.

这与我们在1975年开始使用COBOL编程之前使用的老式的第一种、中间的、最后的方式形成了对比,从那时起就开始使用“make fit”。

#5


11  

Unfortunately this is kind of like asking what is the best way to store a number in the database. It depends on what you are going to do with it - sometimes you want an int,other times a byte, and sometimes a float. With names it depends on things like what cultures do you expect your users to come from, what you plan on doing with the names (will you be using these names to connect with another system that stores names as "last name, first name"?), and how much you can afford to annoy your users. If this is an internal HR application, you can probably afford to annoy the users a lot, and have a very structured, formal breakdown of name components (there are way more than 3 - don't forget mr/mrs, jr, III, multiple middle names, hyphenated last names, and who knows what else if you are trying to handle names from all cultures. If you have a webapp that users might or might not care about, you can't ask them to care too much.

不幸的是,这有点像问在数据库中存储数字的最佳方式是什么。它取决于你要用它做什么——有时你想要一个int,有时是一个字节,有时是一个浮点数。名字它取决于你希望用户来自什么文化,你打算做什么姓名(你会使用这些名称连接与另一个系统,商店名称“姓、名字”?),多少你可以惹恼用户。如果这是一个内部人力资源应用程序中,您可能会承受骚扰用户很多,和有一个非常结构化,正式的名称组件(分解方法有超过3 -不要忘记先生/夫人,jr,三世,多个中间的名字,最后用连字符连接的名字,谁知道还有什么如果你想处理的名字从所有的文化。如果你有一个用户可能关心或不关心的webapp,你不能要求他们太在意。

#6


7  

You may want to search on the 3 separate fields for one and its inexpensive to concatenate for the fullname.

您可能想要在3个独立字段中搜索一个,而将全称连接起来并不昂贵。

e.g. If you want to search for all the Mr. Nolans your query would be

如果你想搜索所有的诺兰先生,你的问题就是

SELECT Title+' '+FirstName+' '+Surname As FullName  
from table where firstname = 'Mr' and surname ='Nolan'

to do this with just the fullnames would be a pain.

用全名来做这件事会很痛苦。

#7


4  

Keeping the fields separate allows you to support different output formats and cultures where the family name is written first

保持字段独立允许您支持不同的输出格式和区域性,在这些格式和区域性中,家族名称首先被写入

#8


4  

Things like ORDER BY firstname or ORDER BY lastname are possible when you break the name up into multiple fields.

当您将名称分割为多个字段时,像按名排序或按姓排序这样的事情是可能的。

Not as easy to do when you mash all names into one field.

当你把所有的名字都混在一起的时候,做起来就不那么容易了。

#9


4  

I'm English and only have one name. I normally put it in the 'surname' field for least aggravation. I am usually forced to put something in the 'first name' field too, which by definition is wrong.

我是英国人,只有一个名字。我通常会把它放在“姓”栏里,以免加重。我通常也会*在“名字”字段中输入一些东西,这在定义上是错误的。

Any attempt to impose anything more than 'Name' is doomed to be wrong at least some of the time, and sometimes be very frustrating to users. Single names are common in Southern India, Indonesia, and Pakistan (which is hundreds of millions of people) as well as the occaisional weirdo on the UK like me.

任何企图强加任何超过“名称”的东西都注定是错误的,至少在某些时候是错误的,有时会让用户非常沮丧。在印度南部、印度尼西亚和巴基斯坦(有数亿人口),以及像我这样的英国人,名字都很常见。

The 'first, middle, last' thing is very U.S.-centric. Few other countries think of names that way. Please stop doing it.

“第一,中间,最后”的东西是以美国为中心的。很少有其他国家这么想名字。请停止这样做。

#10


2  

About the only thing I can think of is for searching purposes. It's a bit better to search a field using [=] rather than say [like].

我能想到的唯一一件事就是为了搜索。使用[=]搜索字段比使用[like]要好一点。

If you have no need to display the name as seperate words then go with a single field.

如果您不需要将名称显示为独立的单词,则使用单个字段。

But if you need to do something like [Dear Mr. Achu] then perhaps a 3 field approach would be better.

但如果你需要做一些类似的事情(亲爱的阿楚先生),也许3领域的方法会更好。

#11


2  

Most of the time it's there to support writing form letters like, "Mr. so-and-so", or to search/sort by last name which is very common.

大多数情况下,它支持书写像“某某先生”这样的字母,或者按姓搜索/排序,这是很常见的。

Given that first/middle/last may not apply to all cultures, there could be a better approach. It might be better expressed as "informal name" / "formal name" / "legal name" or something like that.

考虑到第一/中/最后可能不适用于所有的文化,可能会有更好的方法。它可以更好地表示为“非正式名称”/“正式名称”/“法定名称”或类似的东西。

Still, at this point first/middle/last is very common, and from a data entry standpoint it is what everyone expect.

不过,在这一点上,first/middle/last是非常常见的,从数据输入的角度来看,这是每个人都希望看到的。

#12


2  

Here's the thing, not even humans can get this right all the time, there's just too much data, and too many special cases. I could change my name right now to be 20 parts, with the middle 13 as my "first" name. Parts of names can contain any number of words, and there can be any number of parts of names. Some people only have 1 name (no surname). Some people have lots of middle names. Some people have first or surnames composed of several words. Some people list their surname first. Some people go by their middle name. Some people go by nicknames that aren't obviously related to their given name.

事情是这样的,即使是人类也不可能一直做对,有太多的数据和太多的特殊情况。我现在可以把我的名字改为20个部分,中间13是我的“第一个”名字。名字的部分可以包含任意数量的单词,也可以包含任意数量的名字。有些人只有一个名字(没有姓)。有些人有很多中间名。有些人的名字或姓氏由几个词组成。有些人先说出自己的姓。有些人用中间名。有些人的昵称与他们的名字没有明显的联系。

If you try to guess these conventions in software YOU WILL FAIL. Period. Maybe you'll get it right some of the time, maybe even most of the time, but is even that worth it? In my opinion you should store names as one field and stop trying to be cute by using first names to refer to a person. If you need additional information about a name (e.g. a nickname), ask the user!

如果你试图在软件中猜测这些惯例,你将会失败。时期。也许你有时会做对,甚至大多数时候也会做对,但这值得吗?在我看来,你应该把名字存储在一个字段中,不要用名字来指代一个人,这样会显得很可爱。如果你需要关于一个名字的额外信息(例如一个昵称),问问用户!

#13


1  

Each of the individual names is an atomic piece of data. When they are stored separately then it is easier to print them out in different formats such as Firstname Lastname and Lastname, Firstname.

每个单独的名称都是数据的一个原子部分。当它们分开存储时,就可以更容易地以不同的格式打印出来,如Firstname Lastname和Lastname、Firstname。

#14


1  

There is no benefit if you never need to sort or search by first, middle, or last name.

如果您永远不需要按第一、中间或姓排序或搜索,那么就没有任何好处。

#15


1  

Flexibility.

的灵活性。

e.g. If someone had a double barreled last name and no middle name.

如果有人的姓是双管的,没有中间名。

#16


1  

I voted up some of these answers, but if you are looking to avoid repetitive or redundant or messy concatenation in your code, you can always use a computed column in the database or a method in a class which exposes the name consistently reconstructed. If these concatenations are expensive (because you are printing a million statements), you can use a persisted column.

我对其中的一些答案进行了投票,但是如果您希望避免代码中的重复、冗余或混乱的连接,那么您总是可以在数据库中使用计算列,或者在公开名称的类中使用一贯重构的方法。如果这些连接非常昂贵(因为要打印一百万条语句),那么可以使用持久化列。

Often you will allow users to specify names like nicknames or friendly names, so that you aren't referring to them by the name in their records or always as Mr. Smith.

通常,你会允许用户指定名字,比如昵称或友好的名字,这样你就不会在他们的记录中引用他们的名字,也不会一直用史密斯先生的名字。

It all depends on your requirements. There is no single good answer without the environment it is expected to satisfy.

这完全取决于你的要求。没有它所期望的环境,就没有一个好的答案。

#17


1  

Not sure how practical it would be, but maybe if cultural sensitivity is important in the context of the application being developed, perhaps a name should be a collection with each element of the collection carrying a value indicating if the name is the addressable "first name" or the addressable "surname" and so on for "title" or anything else that needs to be identified. A name ID could be used to identify the order of the elements for re-composing the full name.

不知道是多么实用,但是如果文化敏感性是很重要的,所开发的应用程序的上下文中,也许一个名字应该是一个集合的每个元素集合携带一个值表示如果名称是可寻址的“名字”或可寻址的“姓”等等“标题”或其他需要确认的东西。可以使用名称ID来标识重新组合全名的元素的顺序。

#18


1  

Just have two fields, 'Full Name', and 'Preferred Name' - easy. Supports every name in existance (As long as the language has lexical symbols... So, yes, that excludes languages that do not have a written form).

只有两个字段,“全名”和“首选姓名”——很简单。支持每个名字的存在(只要语言有词汇符号……所以,是的,这排除了没有书面形式的语言)。

Just make sure that they are handled in some unicode format, and that application code properly handles unicode conversion.

只需确保它们以某种unicode格式处理,并且应用程序代码正确处理unicode转换。

#19


0  

To me it is simply better to store 3 names so that explicit parsing is necessary later on if the individual components are needed..

对我来说,最好存储3个名称,以便在以后需要单个组件时需要进行显式解析。

#20


0  

You can't always separate surname from full name cleanly and reliably so there's good reason to separate that because you often need surname. After you do that, there are two common approaches:

你不可能总是干净可靠地把姓和全名分开,所以有充分的理由把它分开,因为你经常需要姓。在你这么做之后,有两种常见的方法:

  1. first_name and middle_name; or
  2. first_name和middle_name;或
  3. given_names.
  4. given_names。

(2) is arguably more preferable because people sometimes have more than tow given names and (1) is more inflexible in this regard.

(2)可以说更可取,因为人们有时有两个以上的名字,(1)在这方面更不灵活。

Also, another common field is preferred_name (in addition to the above).

另外,另一个公共字段是preferred_name(除了上面的字段)。

#21


0  

The i18n issue can be a bugger either way. certain cultures use the surname first and the given name last, that strikes the idea of first and last names so we move to fields for surnames and given names. Wait, some cultures don't have a surname or the surname is modified by the gender of the named.
We can get into tribal cultures where the person is renamed on adulthood. "Sitting Bull" childhood name was "Jumping Badger".
This is somewhat of a ramble but what I am showing is that the more fields you have the more accurate the design is. There should be at least a not null 'given name' field and a optional 'surname' field tied to a PK that is an integer. If the aforementioned requirements are observed, fields can be added without issues of breaking queries.

无论哪种情况,i18n问题都可能是个麻烦。某些文化使用姓名和名名名last,这与姓和名的概念相符,所以我们转到姓氏和名的字段。等等,有些文化没有姓,或者姓是根据名字的性别来修改的。我们可以进入部落文化,这个人在成年后被重新命名。“坐牛”儿时的名字是“跳獾”。这有点像漫步,但我所展示的是,你拥有越多的领域,设计就越精确。应该至少有一个非空的“给定名称”字段和一个可选的“姓”字段绑定到一个整数PK。如果遵守了上述要求,可以添加字段,而不存在中断查询的问题。

#22


0  

Some of the issues can be solved by also storing an additional column like PreferredName. We do that in our DB and also store prefix column and a suffix column. e.g 'Prof Henry W Jones Jnr' with preferred name as 'Indiana Jones'.

可以通过存储额外的列(如PreferredName)来解决一些问题。我们在DB中这样做,并存储前缀列和后缀列。e。“亨利·W·琼斯教授”,优选名字为“印第安纳·琼斯”。