PostgreSQL BITWISE AND
From w3cyberlearnings
Contents |
Postgresql & operator
Bitwise AND comparison. The number has to convert to binary number before the comparison.
Syntax & operator
a & b
Example 1
postgres=# SELECT 12 & 10 as n2; n2 ---- 8 (1 row) // binary 12=1100 10=1010 ------- 8=1000
Example 2
postgres=# SELECT 5 & 10 as n2; n2 ---- 0 (1 row)
Example 3
postgres=# SELECT 2 & 10 as n2; n2 ---- 2 (1 row)
Related Links
- factorial(!)
- absolute value(@)
- bitwise AND(&)
- bitwise OR(|)