开发者

How large to make name fields in database?

There's an old question that asks this very thing, but a lot has changed in databases and unspoken standards.

I generally live by the rule as to never make a field size text or memo, even if it speeds up the database. Primarily because someone could flood and possibly hack the db i开发者_如何学Cf there are no restrictions in the input interface.


That said, what is the general practice these days for name fields in a table?

CREATE TABLE foo (
     name_first  Varchar(64) Not Null
   , name_middle Varchar(64) 
   , name_last   Varchar(64) Not Null
);

I think is my default, but how are others coping with foreign names and more than 3 names?



That should be plenty. We have millions of names from all nationalities and our longest lastname is 29 characters. I would add a personalsuffix field as well for Jr. Sr. III etc.


My theroy is, is better to have a lot more than to need a few. why not to use varchar(100)?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜