Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sql Table data type for email address?

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?

enter image description here

like image 357
user9745220 Avatar asked Jul 03 '18 08:07

user9745220


People also ask

What data type is an email address in access?

There is no specific datatype for email, so your only options are to either create a validation rule for the field that checks your entry is correct, or, the best way to do it would be to validate your email in the user interface itself.

Is varchar an email address?

And as for varchar vs nvarchar, the RFC had different allowed characters for each part of the email address but all the allowable characters for email addresses are all contained in the varchar range.

Which data type is used for contact number in SQL?

Numeric Data Types The default value for size is 1. Zero is considered as false, nonzero values are considered as true. An exact fixed-point number. The total number of digits is specified in size.


2 Answers

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

like image 108
ravi polara Avatar answered Sep 21 '22 11:09

ravi polara


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

like image 30
Danielson Sanches Avatar answered Sep 21 '22 11:09

Danielson Sanches