The BIT
data type is used to store bit values. BIT
数据类型用于存储位值。A type of BIT(
enables storage of M
)M
-bit values. BIT(M)
的类型允许存储M
位值。M
can range from 1 to 64.M
的范围从1到64。
To specify bit values, 要指定位值,可以使用b'
notation can be used. value
'b'value'
表示法。value
is a binary value written using zeros and ones. value
是用0和1写的二进制值。For example, 例如,b'111'
and b'10000000'
represent 7 and 128, respectively. b'111'
和b'10000000'
分别表示7和128。See Section 9.1.5, “Bit-Value Literals”.请参见第9.1.5节,“位值文字”。
If you assign a value to a 如果将一个值赋给长度小于BIT(
column that is less than M
)M
bits long, the value is padded on the left with zeros. M
位的BIT(M)
列,则该值在左侧用零填充。For example, assigning a value of 例如,将b'101'
to a BIT(6)
column is, in effect, the same as assigning b'000101'
.b'101'
的值赋给BIT(6)
列实际上与赋值b'000101'
相同。
NDB Cluster. The maximum combined size of all 给定BIT
columns used in a given NDB
table must not exceed 4096 bits.NDB
表中使用的所有BIT
列的最大组合大小不得超过4096位。