BIT_COUNT(numeric_value)
BIT_COUNT()函数返回激活位 numeric_value 的位数。 下面的例子说明了使用BIT_COUNT()函数返回激活位的数量的一系列数字:
mysql> SELECT BIT_COUNT(2) AS TWO, BIT_COUNT(4) AS FOUR, BIT_COUNT(7) AS SEVEN +-----+------+-------+ | TWO | FOUR | SEVEN | +-----+------+-------+ | 1 | 1 | 3 | +-----+------+-------+ 1 row in set (0.00 sec)