12.12 Bit Functions

Table 12.16 Bitwise Functions

NameDescription
BIT_COUNT() Return the number of bits that are set
& Bitwise AND
~ Invert bits
| Bitwise OR
^ Bitwise XOR
<< Left shift
>> Right shift

MySQL uses BIGINT (64-bit) arithmetic for bit operations, so these operators have a maximum range of 64 bits.