BIT_COUNT Function

Description

The BIT_COUNT function returns the number of bits of expr that have been set to 1; it is not an aggregate function. The return value is a BIGINT type.

Syntax

BIT_COUNT (expr)

Example

SELECT BIT_COUNT(id) FROM bit_tbl WHERE id in(1,3,5);

   bit_count(id)

================

               1

               2

               2