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
-- Both true
f1 := AND(TRUE, TRUE),
-- One false
f2 := AND(TRUE, FALSE),
-- FALSE absorbs NULL
f3 := AND(FALSE, NULL::BOOLEAN),
-- Unknown with TRUE
f4 := AND(TRUE, NULL::BOOLEAN)
;Result
| f1 BOOLEAN | f2 BOOLEAN | f3 BOOLEAN | f4 BOOLEAN |
|---|---|---|---|
| true | false | false | NULL |