XOR
This page is part of MariaDB's Documentation.
The parent of this page is: SQL Operators for MariaDB Xpand
Topics on this page:
Overview
Logical Exclusive "or" operator.
USAGE
value1 XOR value2
Value Name | Description |
---|---|
| A truth value expression |
DETAILS
The XOR
operator compares two truth values, returning 1
(true) if the two values have opposite values, otherwise 0
.
A NULL
is returned if either truth value expression is NULL
.
EXAMPLES
SELECT TRUE XOR TRUE, FALSE XOR FALSE;
+---------------+-----------------+
| TRUE XOR TRUE | FALSE XOR FALSE |
+---------------+-----------------+
| 0 | 0 |
+---------------+-----------------+
SELECT TRUE XOR FALSE, FALSE XOR TRUE;
+----------------+----------------+
| TRUE XOR FALSE | FALSE XOR TRUE |
+----------------+----------------+
| 1 | 1 |
+----------------+----------------+
SELECT 7 XOR 0, 0 XOR 2, 5 XOR 7;
+---------+---------+---------+
| 7 XOR 0 | 0 XOR 2 | 5 XOR 7 |
+---------+---------+---------+
| 1 | 1 | 0 |
+---------+---------+---------+