Get started
Load & manage data
Work with data
Administration
Reference & resources
Updated Mar 29, 2023
Send us feedback
bit_count
Applies to: Databricks SQL Databricks Runtime
Returns the number of bits set in the argument.
bit_count(expr)
expr: A BIGINT or BOOLEAN expression.
expr
An INTEGER.
> SELECT bit_count(0); 0 > SELECT bit_count(5); 2 > SELECT bit_count(-1); 64 > SELECT bit_count(true); 1
| (pipe sign) operator
& (ampersand sign) operator
^ (caret sign) operator
~ (tilde sign) operator