List of standard lengths for database fields

company name max length
first name minimum length
is there a limit to how long your name can be
database lengths
person name database
database field length
database design first name last name
human names with special characters

I'm designing a database table and once again asking myself the same stupid question: How long should the firstname field be?

Does anyone have a list of reasonable lengths for the most common fields, such as first name, last name, and email address?

W3C's recommendation:

If designing a form or database that will accept names from people with a variety of backgrounds, you should ask yourself whether you really need to have separate fields for given name and family name.

… Bear in mind that names in some cultures can be quite a lot longer than your own. … Avoid limiting the field size for names in your database. In particular, do not assume that a four-character Japanese name in UTF-8 will fit in four bytes – you are likely to actually need 12.

https://www.w3.org/International/questions/qa-personal-names

For database fields, VARCHAR(255) is a safe default choice, unless you can actually come up with a good reason to use something else. For typical web applications, performance won't be a problem. Don't prematurely optimize.

Here are the recommended maximum data-length limits for common , How-to: Database field sizes. Some popular best practices on length and data type for common database fields. display names are often used for unofficial '​known as' names , e.g. William Helkathhazzurim is known to everyone as Bill Helka UK Data Type Standard(pdf) - e-Government Interoperability Framework (e-GIF) When creating a database, programmers typically stop and scratch their heads when deciding on a maximum data length for the field. Similarly, hackers fuzzing a field may wonder how many characters should be allocated to the target.

Database field sizes - SQL Server, My own standard lengths for database fields. This is a UK-centric list. database-​lengths.txt. Title 4. Forename 50. Surname 50. Email address 255. Address line 1​  Does anyone have a list of reasonable lengths for the most common fields , such as first name, last name, and email address? I just queried my database with millions of customers in the USA. The maximum first name length was 46.

UK Government Data Standards Catalogue details the UK standards for this kind of thing. It suggests 35 characters for each of Given Name and Family Name, or 70 characters for a single field to hold the Full Name, and 255 characters for an email address. Amongst other things..

My own standard lengths for database fields. This is a UK-centric list , This is a list of all the database fields that are not system generated and what each field's value Can accept a max length of 100 characters for the value. The field type determines the type of data that a user can enter into the field (alphanumeric, numeric, date, and so on) or determines how the field functions in the database, for example, is an image displayed in the field when a user selects an image file of an allowed type, does the field link to another field in a different database, and so on.

Some probably correct column lengths
                            Min Max

Hostname                    1   255
Domain Name                 4   253
Email Address               7   254
Email Address [1]           3   254
Telephone Number            10  15      
Telephone Number [2]        3   26  
HTTP(S) URL w domain name   11  2083        
URL [3]                     6   2083    
Postal Code [4]             2   11
IP Address (incl ipv6)      7   45
Longitude                   numeric 9,6
Latitude                    numeric 8,6
Money[5]                    numeric 19,4

[1] Allow local domains or TLD-only domains
[2] Allow short numbers like 911 and extensions like 16045551212x12345
[3] Allow local domains, tv:// scheme
[4] http://en.wikipedia.org/wiki/List_of_postal_codes. Use max 12 if storing dash or space
[5] http://stackoverflow.com/questions/224462/storing-money-in-a-decimal-column-what-precision-and-scale
A long rant on personal names

A personal name is either a Polynym (a name with multiple sortable components), a Mononym (a name with only one component), or a Pictonym (a name represented by a picture - this exists due to people like Prince).

A person can have multiple names, playing roles, such as LEGAL, MARITAL, MAIDEN, PREFERRED, SOBRIQUET, PSEUDONYM, etc. You might have business rules, such as "a person can only have one legal name at a time, but multiple pseudonyms at a time".

Some examples:

names: [
  {
    type:"POLYNYM",
    role:"LEGAL",
    given:"George",
    middle:"Herman",
    moniker:"Babe",
    surname:"Ruth",
    generation:"JUNIOR"
  },
  {
    type:"MONONYM",
    role:"SOBRIQUET",
    mononym:"The Bambino" /* mononyms can be more than one word, but only one component */
  },
  {
    type:"MONONYM",
    role:"SOBRIQUET",
    mononym:"The Sultan of Swat"
  }
]

or

names: [
  {
    type:"POLYNYM",
    role:"PREFERRED",
    given:"Malcolm",
    surname:"X"
  },
  {
    type:"POLYNYM",
    role:"BIRTH",
    given:"Malcolm",
    surname:"Little"
  },
  {
    type:"POLYNYM",
    role:"LEGAL",
    given:"Malik",
    surname:"El-Shabazz"
  }
]

or

names:[
  {
    type:"POLYNYM",
    role:"LEGAL",
    given:"Prince",
    middle:"Rogers",
    surname:"Nelson"
  },
  {
    type:"MONONYM",
    role:"SOBRIQUET",
    mononym:"Prince"
  },
  {
    type:"PICTONYM",
    role:"LEGAL",
    url:"http://upload.wikimedia.org/wikipedia/en/thumb/a/af/Prince_logo.svg/130px-Prince_logo.svg.png"
  }
]

or

names:[
  {
    type:"POLYNYM",
    role:"LEGAL",
    given:"Juan Pablo",
    surname:"Fernández de Calderón",
    secondarySurname:"García-Iglesias" /* hispanic people often have two surnames. it can be impolite to use the wrong one. Portuguese and Spaniards differ as to which surname is important */
  }
]

Given names, middle names, surnames can be multiple words such as "Billy Bob" Thornton, or Ralph "Vaughn Williams".

Maximum String Length for Common Database Fields, is able to store up to 50 letters, numbers or symbols. In some situations, you may need to use all 50, but think about forenames. Two option fields don’t provide format options at the field level. But when you add one to the form you can choose to display them as radio buttons, a check box, or a select list. Status: A system field that has options that generally correspond to active and inactive status.

I would say to err on the high side. Since you'll probably be using varchar, any extra space you allow won't actually use up any extra space unless somebody needs it. I would say for names (first or last), go at least 50 chars, and for email address, make it at least 128. There are some really long email addresses out there.

Another thing I like to do is go to Lipsum.com and ask it to generate some text. That way you can get a good idea of just what 100 bytes looks like.

What are the database field definitions and limitations?, ). While most addresses tend to be under this limit, there are always outliers that you'll want your business solution to be ready to handle. Standard Database Format In order to be usable with METAL-MLEE, databases must be in a standard format. This format is similar to the formats used by the C4.5 [Quinlan 1993] and C5.0 machine learning algorithms, but with additional constraints. If your database does not conform to the format explained below in more detail, it needs to be converted.

GCSE ICT - Database terminology, fields, tables, files , ) in a Database Management System which can hold letters and numbers. This article presents a naming scheme for database tables and fields. Database developers have historically used a somewhat cryptic system for naming database tables and fields. Originally a result of the limitations of database management systems (DBMS), these naming schemes - or the lack thereof - have been adopted by convention and tradition.

Character Limitations in Shipping Address Fields – There is a , Every time a new application or form or database is build for your business the same… Choosing the right length for fields (and the BS7666 Standard) and restrictions for common address and names data fields. It uses  The average lengths of email addresses in your database is not a good measure for recommendation. The maximum valid length of an email address is 254 chars and should be the length specified in the database.

varchar, I'm designing a database table and once again asking myself the same stupid question: How long should the firstname field be? Does anyone  Most databases will have a default field length set up, in this case it is 50. This means that each text field is able to store up to 50 letters, numbers or symbols. In some situations, you may need to use all 50, but think about forenames. How long is the longest one you can think of?

Comments
  • Just make sure you allow non-alpha characters in the names! points at hyphen in his last name
  • See "Maximum length of a valid email id" for maximum e-mail address length.
  • One note: don't require both a "first name" and a "last name". Some people, like me, only have one name. (Proof: web.archive.org/web/20130115074449/http://saizai.com/…)
  • What about URL, like blog or link to profile?
  • Screwed if the name is as long as this one gintama.wikia.com/wiki/Jugem_Jugem
  • It’s been 10 years since I asked that question. With another 10 years of experience under my belt, I’m inclined to agree with you.
  • How exactly would you print a name that is 255 characters long on an envelope?
  • Compared to yours, the databases I have access to are tiny, but even there I found an email address of 138 characters. The localpart component is obviously some sort of LDAP (or AD?) distinguished name.
  • How about phone numbers?
  • @EricZBeard Does "street address" include the house number?
  • The average lengths of email addresses in your database is not a good measure for recommendation. The maximum valid length of an email address is 254 chars and should be the length specified in the database. Additionally having lists of email addresses in a single column signifies to me that your data is not normalized and thus invalidates your answer further.
  • @MGOwen First, you don't know the purpose of the database, in certain settings someone being denied access because of a frivolous issue like their email being "too long" could be a major issue. Secondly, the link you posted says "The longest valid one is 89", where as this one says it's 62. Which is right? If you just want to pick an arbitrary number or you have a valid reason like the name must be included as part of the address, fine. However it is still reasonable, that when in doubt, you refer to the spec. I still hold that a single person saying "my database maxes at x" is anecdotal.