Possible Duplicate:
Common mySQL fields and their appropriate data types
What are the recommended database column sizes for names?
I am looking for what would be the most correct field type and size to store email address into a mysql table.
I was initially considering varchar 255 but I think 255 might be too much or even too little what is the average size where I would be able to catch all kinda of valid email address ?
Most people believe it to be 320 characters (64 characters for the username + 255 characters for the domain + 1 character for the @ symbol). Other sources suggest 129 (64 + 1 + 64) or 384 (128+1+255, assuming the username doubles in length in the future).
you can use varchar as your data type for email column as emails are usually composed of letters, numbers and special characters. Show activity on this post. The right value of data lenght for the email field is database-agnostic.
TLDR Answer. Use a VARCHAR(256) to store the 256 character maximum entailed in current, prevailing RFC Internet standards.
use the varchar(50) datatype.
According to RFC 5321, forward and reverse path can be up to 256 chars long, so the email address can be up to 254 characters long. You're safe with using 255 chars.
RFC5321 and RFC5322, the relevant standards for SMTP, specify that an address consists of a local part and a domain. They further state that the maximum sizes for those are respectively 64 and 253 octets, though there's a further 256-octet limit imposed by the forward and reverse paths, including the punctuation (so 254 in reality).
So that should be all that you need for that.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With