user9745220
user9745220

Reputation: 253

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

Upvotes: 19

Views: 98940

Answers (4)

Cheshire Cat
Cheshire Cat

Reputation: 1961

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.

Upvotes: 0

ravi polara
ravi polara

Reputation: 572

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

Upvotes: 17

Danielson Sanches
Danielson Sanches

Reputation: 124

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

Upvotes: 8

user10007778
user10007778

Reputation:

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

Upvotes: 4

Related Questions