AND()
All functions > LOGICAL > AND()
Returns TRUE when both boolean operands are TRUE.
Signatures
Returns: TRUE only when both operands are TRUE; FALSE when either operand is FALSE; otherwise NULL (three-valued logic)
AND(expr1: BOOLEAN, expr2: BOOLEAN) → BOOLEAN sql
| Parameter | Type | Required | Description |
|---|---|---|---|
expr1 | BOOLEAN | Yes | First boolean expression |
expr2 | BOOLEAN | Yes | Second boolean expression |
Notes
- Binary only (two arguments); chain with repeated AND for more conjuncts
- Three-valued logic: NULL is unknown — see Related operators for the truth table
Related operators
Examples
AND(expr1, expr2)
FeatureQL
SELECT
f1 := AND(TRUE, TRUE), -- Both true
f2 := AND(TRUE, FALSE), -- One false
f3 := AND(FALSE, NULL::BOOLEAN), -- FALSE absorbs NULL
f4 := AND(TRUE, NULL::BOOLEAN) -- Unknown with TRUE
;Result
| f1 BOOLEAN | f2 BOOLEAN | f3 BOOLEAN | f4 BOOLEAN |
|---|---|---|---|
| true | false | false | NULL |