Jump to: navigation, search

PostgreSQL BIT LENGTH

From w3cyberlearnings

Contents

Postgresql bit_length

Returns the number of bits in string. Single character is 8 bites.

Syntax bit_length

bit_length(string)

Example 1

test2=# SELECT bit_length('a');
 bit_length 
------------
          8
(1 row)

test2=# SELECT bit_length('apple');
 bit_length 
------------
         40
(1 row)

Example 2

test2=# SELECT user_firstname,
test2-# bit_length(user_firstname)
test2-# FROM profile;
 user_firstname | bit_length 
----------------+------------
 Jim            |         24
 king           |         32
 Jammi          |         40
 Bob            |         24
                |           
(5 rows)

Related Links


Navigation
Web
SQL
MISC
References