Bitwise Operators

Bitwise operators are used for comparing numbers based on their binary digits. These operators are listed in Table B-4.

The tilde (~) may be used to invert the bits of a value.

Table B-4. Bitwise operators

Operator

Use

|

OR

^

XOR

&

AND

<<

Shift bits to left

>>

Shift bits to right

~

NOT or invert bits

Get MySQL in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.