Database: MySQL



Bitwise XOR.

The result type depends on whether the arguments are evaluated as
binary strings or numbers:

o Binary-string evaluation occurs when the arguments have a binary
string type, and at least one of them is not a hexadecimal literal,
bit literal, or NULL literal. Numeric evaluation occurs otherwise,
with argument conversion to unsigned 64-bit integers as necessary.

o Binary-string evaluation produces a binary string of the same length
as the arguments. If the arguments have unequal lengths, an
.html#error_er_invalid_bitwise_operands_size) error occurs. Numeric
evaluation produces an unsigned 64-bit integer.

For more information, see the introductory discussion in this section.

URL: https://dev.mysql.com/doc/refman/8.0/en/bit-functions.html


mysql> SELECT 1 ^ 1;
-> 0
mysql> SELECT 1 ^ 0;
-> 1
mysql> SELECT 11 ^ 3;
-> 8
mysql> SELECT HEX(_binary X'FEDC' ^ X'1111');
-> 'EFCD'