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
ParameterTypeRequiredDescription
expr1BOOLEANYesFirst boolean expression
expr2BOOLEANYesSecond 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 BOOLEANf2 BOOLEANf3 BOOLEANf4 BOOLEAN
truefalsefalseNULL

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