NOT
All functions > LOGICAL > NOT
Returns FALSE if the operand is TRUE, TRUE if it is FALSE.
Syntax
NOT expr · NOT(expr)
Function form
Returns: Negated truth value; NULL if the operand is NULL
NOT(expr1: BOOLEAN) → BOOLEAN sql
| Parameter | Type | Required | Description |
|---|---|---|---|
expr1 | BOOLEAN | Yes | Boolean expression to negate |
Notes
- Applies to boolean expressions, including comparisons and other logical combinations
- NULL in, NULL out
Examples
NOT expr
FeatureQL
RETURN
-- Prefix negates false
f1 := NOT FALSE,
-- Prefix negates true
f2 := NOT TRUE,
-- NULL operand
f3 := NOT NULL::BOOLEAN
;Result
| f1 BOOLEAN | f2 BOOLEAN | f3 BOOLEAN |
|---|---|---|
| true | false | NULL |
NOT(expr)
FeatureQL
RETURN
-- Negate false
f1 := NOT(FALSE),
-- Negate true
f2 := NOT(TRUE),
-- NULL operand
f3 := NOT(NULL::BOOLEAN)
;Result
| f1 BOOLEAN | f2 BOOLEAN | f3 BOOLEAN |
|---|---|---|
| true | false | NULL |