top of page
CerebroSQL

MySQL: 

BIT_COUNT

Syntax:
BIT_COUNT(N)

Returns the number of bits that are set in the argument N as an
unsigned 64-bit integer, or NULL if the argument is NULL.

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

Example

mysql> SELECT BIT_COUNT(64), BIT_COUNT(BINARY 64);
-> 1, 7
mysql> SELECT BIT_COUNT('64'), BIT_COUNT(_binary '64');
-> 1, 7
mysql> SELECT BIT_COUNT(X'40'), BIT_COUNT(_binary X'40');
-> 1, 1

bottom of page