Categories:
Conditional Expression Functions

BOOLNOT

Computes the Boolean NOT of a single numeric expression. In accordance with Boolean semantics:

  • Non-zero values (including negative numbers) are regarded as True.
  • Zero values are regarded as False.

As a result, the function returns:

  • True if the expression is zero.
  • False if the expression is non-zero.
  • NULL if the expression is NULL.
See also:
BOOLAND , BOOLOR , BOOLXOR

Syntax

BOOLNOT( expr )

Examples

SELECT BOOLNOT(0), BOOLNOT(10), BOOLNOT(-3.79), BOOLNOT(NULL);

+------------+-------------+----------------+---------------+
| BOOLNOT(0) | BOOLNOT(10) | BOOLNOT(-3.79) | BOOLNOT(NULL) |
|------------+-------------+----------------+---------------|
| True       | False       | False          | NULL          |
+------------+-------------+----------------+---------------+