BITWISE_AND()

All functions > BITWISE > BITWISE_AND()

Returns the bitwise AND of two bitstrings.

Signatures

Returns: Result bitstring, or NULL if either operand is NULL

BITWISE_AND(left: BITSTRING, right: BITSTRING) → BITSTRING
sql
ParameterTypeRequiredDescription
leftBITSTRINGYesLeft operand
rightBITSTRINGYesRight operand

Notes

  • Both operands must have the same length
  • Each bit position is ANDed independently: 1 AND 1 = 1, all other combinations = 0
  • Returns NULL if either input is NULL

Related operators

Examples

FeatureQL
SELECT
    f1 := BITWISE_AND('10101'::BITSTRING, '10001'::BITSTRING)::VARCHAR -- AND preserves common 1-bits
;
Result
f1 VARCHAR
10001

Last update at: 2026/05/26 17:22:09