MySQL :: MySQL 8.4 Reference Manual :: 13.1.5 Bit-Value Type (original) (raw)
13.1.5 Bit-Value Type - BIT
The BIT
data type is used to store bit values. A type ofBIT(_`M`_)
enables storage of M
-bit values.M
can range from 1 to 64.
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. SeeSection 11.1.5, “Bit-Value Literals”.
If you assign a value to aBIT(_`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 assigningb'000101'
.
NDB Cluster. The maximum combined size of all BIT
columns used in a given NDB table must not exceed 4096 bits.