Expression & Operators
 
Bit Operators
 
Bit operators, perform bitwise intersection, union and exclusive-OR where each bit of the result is evaluated as the logical AND, OR, or exclusive-OR of the corresponding bits of the operands.
 
(The XOR and ^ exclusive-OR operators are not available until MySQL 4.0.2.) You can also perform bit shifts left or right. Bit operations are performed using BIGINT (64-bit) integer values.
 
Bit Operators

Operator

Syntax

Meaning

&

a & b

Bitwise AND (intersection); each bit of result is set if corresponding bits of both operands are set

|

a | b

Bitwise OR (union); each bit of result is set if corresponding bit of either operand is set

^

a ^ b

Bitwise exclusive-OR; each bit of result is set only if exactly one corresponding bit of the operands is set

<<

a << b

Left shift of a by b bit positions

>>

a >> b

Right shift of a by