我正在设计一个数据库表,问自己这个问题:名字字段应该多长?
谁有最常见的字段(如名字、姓氏和电子邮件地址)的合理长度的列表?
我正在设计一个数据库表,问自己这个问题:名字字段应该多长?
谁有最常见的字段(如名字、姓氏和电子邮件地址)的合理长度的列表?
当前回答
我通常会选择:
名字:30个字符 姓氏:30个字符 电子邮件:50个字符 地址:200个字符
如果我担心名称字段太长,我有时也会将名称字段设置为50,因为现在存储空间很少成为问题。
其他回答
Just looking though my email archives, there are a number of pretty long "first" names (of course what is meant by first is variable by culture). One example is Krishnamurthy - which is 13 letters long. A good guess might be 20 to 25 letters based on this. Email should be much longer since you might have firstname.lastname@somedomain.com. Also, gmail and some other mail programs allow you to use firstname.lastname+sometag@somedomain.com where "sometag" is anything you want to put there so that you can use it to sort incoming emails. I frequently run into web forms that don't allow me to put in my full email address without considering any tags. So, if you need a fixed email field maybe something like 25.25+15@20.3 in characters for a total of 90 characters (if I did my math right!).
英国政府数据标准目录详细说明了这类事情的英国标准。 它建议“名”和“姓”各有35个字符,“全名”为70个字符,“电子邮件地址”为255个字符。除此之外…
+------------+---------------+---------------------------------+
| Field | Length (Char) | Description |
+------------+---------------+---------------------------------+
|firstname | 35 | |
|lastname | 35 | |
|email | 255 | |
|url | 60+ | According to server and browser |
|city | 45 | |
|address | 90 | |
+------------+---------------+---------------------------------+
编辑:增加了一些间距
我想找到同样的答案,在公认的答案中提到的英国政府数据标准听起来很理想。然而,这些似乎都不存在了——经过长时间的搜索,我在一个存档中找到了它:http://webarchive.nationalarchives.gov.uk/+/http://www.cabinetoffice.gov.uk/govtalk/schemasstandards/e-gif/datastandards.aspx。需要下载zip,解压,然后在html文件夹中打开default.htm。
是varchar,对吧?所以不管你用50个还是25个,为了安全起见,最好用50个,我认为我见过的最长的是19个左右。姓更长