Loading

Bitwise Operators

  • Bitwise Operators are:

Bitwise operators

Description

&

Bitwise AND

|

Bitwise OR

^

Bitwise exclusive OR

<<

Left Shift

>>

Right Shift


Syntax:

SELECT (col1 & num1), (col2 | num2), ….. FROM tableName;

Example:

Create student table:

IDNamePhysicsChemistry
1Aman8692
2Sushant9191
3Saumya9898

Bitwise AND operations:

SELECT Physics & Chemistry FROM student;

Bitwise OR Operation:

SELECT Physics | Chemistry FROM student;