8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

13.1.5 位值类型 - BIT13.1.5 Bit-Value Type - BIT

BIT 数据类型用于存储位值。类型 BIT(M) 可以存储 M 位的值。M 的范围是 1 到 64。The BIT data type is used to store bit values. A type of BIT(M) enables storage of M-bit values. M can range from 1 to 64.

要指定位值,可以使用 b'value' 表示法。value 是用零和一表示的二进制值。例如,b'111' 和 b'10000000' 分别表示 7 和 128。参见 第 11.1.5 节,“位值文字”。To specify bit values, b'value' notation can be used. value is a binary value written using zeros and ones. For example, b'111' and b'10000000' represent 7 and 128, respectively. See Section 11.1.5, “Bit-Value Literals”.

如果你为 BIT(M) 列分配的值少于 M 位,该值将在左侧用零填充。例如,将值 b'101' 分配给 BIT(6) 列,实际上等同于分配 b'000101'。If you assign a value to a BIT(M) column that is less than M bits long, the value is padded on the left with zeros. For example, assigning a value of b'101' to a BIT(6) column is, in effect, the same as assigning b'000101'.

NDB 集群。 在给定的 NDB 表中使用的所有 BIT 列的最大总大小不得超过 4096 位。NDB Cluster.  The maximum combined size of all BIT columns used in a given NDB table must not exceed 4096 bits.