ARTICLES

Maximum String Length for Common Database Fields

When designing a database schema you often have to make decisions on a fields length. Rather then just guess at a number, use the maximum possible value that could conceivably be used for the field. Below is a chart of common database fields such as email address, city, zip code and country name and the maximum possible length value that can be used.

<td>
  Character Length
</td>

<td>
  Example
</td>
<td>
  254
</td>

<td>
  see RFC5321
</td>
<td>
  189
</td>

<td>
  Longest City Name is Bangkok in Thai: Krung Thep Mahanakhon Amon Rattanakosin Mahinthara Ayuthaya Mahadilok Phop Noppharat Ratchathani Burirom Udomratchaniwet Mahasathan Amon Piman Awatan Sathit Sakkathattiya Witsanukam Prasit
</td>
<td>
  18
</td>

<td>
  Country with the longest zip code format is Chile with NNNNNNN, NNN-NNNN
</td>
<td>
  90
</td>

<td>
  Longest country name is Libya&#8217;s Arabic name prior to 2013: al-Jam-h-riyyah al-‘Arabiyyah al-L?biyyah ash-Sha‘biyyah al-Ishtir-kiyyah al-‘U-má
</td>
Field Name
email address
city
zip code
country