Categories:

Conditional expression functions

BOOLOR

Computes the Boolean OR of two numeric expressions. 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 both expressions are non-zero or one expression is non-zero and the other expression is zero or NULL.

  • False if both expressions are zero.

  • NULL if both expressions are NULL or one expression is NULL and the other expression is zero.

See also:

BOOLAND , BOOLNOT , BOOLXOR

Syntax

BOOLOR( expr1 , expr2 )
Copy

Examples

SELECT BOOLOR(1, 2), BOOLOR(-1.35, 0), BOOLOR(3, NULL), BOOLOR(0, 0), BOOLOR(NULL, 0), BOOLOR(NULL, NULL);

+--------------+------------------+-----------------+--------------+-----------------+--------------------+
| BOOLOR(1, 2) | BOOLOR(-1.35, 0) | BOOLOR(3, NULL) | BOOLOR(0, 0) | BOOLOR(NULL, 0) | BOOLOR(NULL, NULL) |
|--------------+------------------+-----------------+--------------+-----------------+--------------------|
| True         | True             | True            | False        | NULL            | NULL               |
+--------------+------------------+-----------------+--------------+-----------------+--------------------+
Copy
Language: English