IS
This page is part of MariaDB's Documentation.
The parent of this page is: SQL Operators for MariaDB Xpand
Topics on this page:
Overview
Boolean comparison.
USAGE
expression IS TRUE|FALSE|UNKNOWN
Value Name | Description |
---|---|
| A value expression |
DETAILS
The IS
operator returns a truth value for one of 3 boolean comparisons:
x IS TRUE
checks if the expression evaluates toTRUE
(a non-zero value)x IS FALSE
checks if the expression evaluates toFALSE
(a zero value)x IS UNKNOWN
checks if the expression has no known value (isNULL
)
The return value is always 1
(true) or 0
(false). Evaluating a NULL
value does not return NULL
because this operator considers it to be UNKNOWN
and never TRUE
or FALSE
.
See IS NOT for the negated version of these comparisons.
EXAMPLES
SELECT 1 IS TRUE, 1 IS FALSE, 1 IS UNKNOWN;
+-----------+------------+--------------+
| 1 IS TRUE | 1 IS FALSE | 1 IS UNKNOWN |
+-----------+------------+--------------+
| 1 | 0 | 0 |
+-----------+------------+--------------+
SELECT 0 IS TRUE, 0 IS FALSE, 0 IS UNKNOWN;
+-----------+------------+--------------+
| 0 IS TRUE | 0 IS FALSE | 0 IS UNKNOWN |
+-----------+------------+--------------+
| 0 | 1 | 0 |
+-----------+------------+--------------+
SELECT NULL IS TRUE, NULL IS FALSE, NULL IS UNKNOWN;
+--------------+---------------+-----------------+
| NULL IS TRUE | NULL IS FALSE | NULL IS UNKNOWN |
+--------------+---------------+-----------------+
| 0 | 0 | 1 |
+--------------+---------------+-----------------+
SELECT 42 = TRUE, 42 IS TRUE;
+-----------+------------+
| 42 = TRUE | 42 IS TRUE |
+-----------+------------+
| 0 | 1 |
+-----------+------------+