Documentation Home
MySQL 9.4 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr) - 41.2Mb
PDF (A4) - 41.3Mb
Man Pages (TGZ) - 262.8Kb
Man Pages (Zip) - 368.8Kb
Info (Gzip) - 4.1Mb
Info (Zip) - 4.1Mb


MySQL 9.4 Reference Manual  / ...  / Data Types  / Numeric Data Types  /  Bit-Value Type - BIT

13.1.5 Bit-Value Type - BIT

TheBIT data type is used to store bit values. A type ofBIT(M) enables storage ofM-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' andb'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 thanM bits long, the value is padded on the left with zeros. For example, assigning a value ofb'101' to aBIT(6) column is, in effect, the same as assigningb'000101'.

NDB Cluster.  The maximum combined size of allBIT columns used in a givenNDB table must not exceed 4096 bits.