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?
– user9745220
Jul 3 at 8:31
– Gary Mendonca
Jul 3 at 8:33
– user9745220
Jul 3 at 8:38
– 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.
– Larnu
Jul 3 at 8:27