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
    -- 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 BOOLEANf2 BOOLEANf3 BOOLEANf4 BOOLEAN
truefalsefalseNULL

Last update at: 2026/06/20 10:08:10