Sql Table data type for email?

Sql Table data type for email?

What data type should i use for an email? Just started to learn SQL, and i tried to make some columns, here’s table for ID,Username,Password,Money, and Email. Did i made that correctly?
enter image description here

You’ve tagged MySQL and SQL Server here, which are you actually using?
– Larnu
Jul 3 at 8:27

Sorry i forgot the image
– user9745220
Jul 3 at 8:31

Does the email contain only text?
– Gary Mendonca
Jul 3 at 8:33

no it contains the @ symbol, so what type i should use?>
– user9745220
Jul 3 at 8:38

This looks like a duplicate of stackoverflow.com/questions/1199190/…
– Joakim Danielson
Jul 3 at 8:38

3 Answers
3

you can use varchar as your data type for email column as emails are usually composed of letters, numbers and special characters.

Since the max lenght for a email is 254 characters, i would recommend you to use nvarchar(255). That should be enough

It’s good to go with NVARCHAR(320) – 64 characters for local part + @ + 255 for domain name.

You Use varchar(255) and nvarchar(255) Data type

By clicking “Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

發表留言