BIT_COUNT()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Enterprise Server
Topics on this page:
Overview
Returns the number of bits set in the given argument.
EXAMPLES
CREATE TABLE bitcount_example (
example BIGINT
);
INSERT INTO bitcount_example VALUES
(42), (101), (99), (13), (64), (86);
SELECT BIN(example), BIT_COUNT(example) FROM bitcount_example;
+--------------+--------------------+
| BIN(example) | BIT_COUNT(example) |
+--------------+--------------------+
| 101010 | 3 |
| 1100101 | 4 |
| 1100011 | 4 |
| 1101 | 3 |
| 1000000 | 1 |
| 1010110 | 4 |
+--------------+--------------------+
CHANGE HISTORY
EXTERNAL REFERENCES
Additional information on this topic may be found in the MariaDB Public Knowledge Base.