Skip to main content
Version: V1.2.0

BIT_COUNT

Declaration​

BIT_COUNT(N)

Description​

Returns the number of 1 bits in the binary representation of N. If N is NULL, returns NULL.

Examples​

SELECT BIT_COUNT(42), BIT_COUNT(b'1010');
+---------------+--------------------+
| BIT_COUNT(42) | BIT_COUNT(b'1010') |
+---------------+--------------------+
| 3 | 2 |
+---------------+--------------------+
1 row in set (0.001 sec)