MySQL tutorial: XOR [EN]
top of page
CerebroSQL

MySQL: 

XOR

Syntax:
XOR

Logical XOR. Returns NULL if either operand is NULL. For non-NULL
operands, evaluates to 1 if an odd number of operands is nonzero,
otherwise 0 is returned.

Example

mysql> SELECT 1 XOR 1;
-> 0
mysql> SELECT 1 XOR 0;
-> 1
mysql> SELECT 1 XOR NULL;
-> NULL
mysql> SELECT 1 XOR 1 XOR 1;
-> 1

bottom of page