Name

BIT_LENGTH( )

Synopsis

BIT_LENGTH(string)

This function returns the number of bits in a given string. The following example uses the default character set, where one character requires 8 bits.

SELECT BIT_LENGTH('a') AS 'One Character',
BIT_LENGTH('ab') AS 'Two Characters';
+---------------+----------------+
| One Character | Two Characters |
+---------------+----------------+
|             8 |             16 |
+---------------+----------------+

Get MySQL in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.