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 make that correctly?
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 make that correctly?
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
Since the max lenght for a email is 254 characters, i would recommend you to use nvarchar(255). That should be enough
you can use varchar as your data type for email column as emails are usually composed of letters, numbers and special characters.
The right value of data lenght for the email field is database-agnostic. If you are also considering standard SQL types, the same can be said for data type, that is a string. You can take a look at this.