数据库中电子邮件地址的最佳长度是多少? [英] What is the optimal length for an email address in a database?

查看:199
本文介绍了数据库中电子邮件地址的最佳长度是多少?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下是我查询的一部分,反映了 EMAIL_ADDRESS 列数据类型和属性:

Here is an extracted portion of my query, reflecting the EMAIL_ADDRESS column data type and property:

EMAIL_ADDRESS CHARACTER VARYING(20) NOT NULL, 

然而, John Saunders 使用 VARYING(256)

这表明我不一定能正确地理解VARYING。

This suggests me that I have not necessarily understood the VARYING correctly.

我理解这一点,我的情况下电子邮件地址的长度是20个字符,而Jodn的长度是256个字符。

I understand it such that the length of an email address is 20 characters in my case, while 256 for Jodn.

约翰的代码中的上下文

CREATE TABLE so."User"
  (
    USER_ID SERIAL NOT NULL,
    USER_NAME CHARACTER VARYING(50) NOT NULL,
    EMAIL_ADDRESS CHARACTER VARYING(256) NOT NULL, // Here
    HASHED_PASSWORD so.HashedPassword NOT NULL,
    OPEN_ID CHARACTER VARYING(512),                                                         
    A_MODERATOR BOOLEAN,
    LOGGED_IN BOOLEAN,
    HAS_BEEN_SENT_A_MODERATOR_MESSAGE BOOLEAN,
    CONSTRAINT User_PK PRIMARY KEY(USER_ID)
  );

我从未看到普通人使用的超过20个字符的电子邮件地址。

I have never seen email addresses longer than 20 characters, used by ordinary people.

数据库中电子邮件地址的最佳长度是多少?

What is the optimal length for an email address in a database?

推荐答案

电子邮件地址的长度为254个字符。

The maximum length of an email address is 254 characters.

每个电子邮件地址由两部分组成。在@号之前的本地部分,以及跟随它的域部分。在user@example.com中,本地部分为用户,域名为example.com。

Every email address is composed of two parts. The local part that comes before the '@' sign, and the domain part that follows it. In "user@example.com", the local part is "user", and the domain part is "example.com".

本地部分不得超过64字符和域部分不能超过255个字符。

The local part must not exceed 64 characters and the domain part cannot be longer than 255 characters.

电子邮件地址的本地+ @ +域部分的长度不能超过254个字符。如 RFC3696勘误ID 1690 所述。

The combined length of the local + @ + domain parts of an email address must not exceed 254 characters. As described in RFC3696 Errata ID 1690.

我从这里获得了这些信息的原始部分

这篇关于数据库中电子邮件地址的最佳长度是多少?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆