BIT_XOR
Description
The BIT_XOR function is used to calculate the bitwise XOR result of a set of integer data. Bitwise XOR operation compares the corresponding bits of two binary numbers; if the two bits are the same, the result is 0, and if they are different, the result is 1.
Parameter Description
- expr: Integer type expression, which can be of type tinyint, smallint, int, or bigint.
- distinct (optional): When using the distinct keyword, the function will calculate the bitwise XOR result of the deduplicated set.
Return Result
- The return value type is consistent with the parameter type.
- If the parameters contain null values, the null values do not participate in the calculation.
Usage Example
- Calculate the bitwise XOR result of a set of integers:
Permalink
- Calculate the bitwise XOR result of the deduplicated integer set:
- Calculate the bitwise XOR result in the actual data table:
- Calculate the bitwise XOR result of an integer set containing null values: