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
| Parameter | Type | Required | Description |
|---|---|---|---|
left | BITSTRING | Yes | Left operand |
right | BITSTRING | Yes | Right 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 |
On this page