BIT_AND
Description
The BIT_AND function is used to calculate the bitwise AND result of a specified expression within a set of data. This function operates on integer types of data, including tinyint, smallint, int, and bigint types. By using the BIT_AND function, you can perform bitwise operations on data to achieve precise control and processing of the data.
Parameter Description
- expr (required): An integer type expression, including tinyint, smallint, int, and bigint types.
- distinct (optional): When set to distinct, the function will calculate the bitwise AND result of the deduplicated set.
Return Result
- The return value type is consistent with the parameter type.
- If distinct is set, the bitwise AND result of the deduplicated set is returned.
- Null values are not included in the calculation.
Usage Example
- Calculate the bitwise AND result of a set of data (distinct not set):
- Calculate the bitwise AND result of a set of data (set distinct and include duplicates):
- Calculate the bitwise AND result of a set of data (including null values):
- Calculate the bitwise AND result of different integer types: