bit_count

description

Syntax

BIT_COUNT(Integer-type x)

Returns the exist count of one in 2’s complement represent of integer x.

Integer-type could be: TINYINT、SMALLINT、INT、BIGINT、LARGEINT

example

  1. select "0b11111111", bit_count(-1)
  2. --------------
  3. +--------------+---------------+
  4. | '0b11111111' | bit_count(-1) |
  5. +--------------+---------------+
  6. | 0b11111111 | 8 |
  7. +--------------+---------------+

keywords

  1. BITCOUNT, BIT_COUNT