MySQL BIT_LENGTH() Functions – String Functions
MySQL BIT_LENGTH() Functions: Syntax
MySQL BIT_LENGTH() Functions: Description
BIT_LENGTH() returns the length of the string passed as input in bits.
MySQL BIT_LENGTH() Functions: Parameter
[table caption=”” width=”100%” colwidth=”15%|15%|15%|55%” colalign=”left|lef|lef|left”]
Name, Required /Optional, Value Type, Description
string , Required, String , The input string.
[/table]
MySQL BIT_LENGTH() Functions: Output
[table caption=”” width=”100%” colwidth=”20%|80%” colalign=”left|left”]
Returns,
bits, returns the length of the string passed as input in bits.
[/table]
MySQL BIT_LENGTH() Functions: Example 1
mysql> SELECT BIT_LENGTH(‘tutor’);
+———————+
| BIT_LENGTH(‘tutor’) |
+———————+
| 40 |
+———————+
1 row in set (0.00 sec)
mysql> SELECT BIT_LENGTH(‘123’);
+——————-+
| BIT_LENGTH(‘123’) |
+——————-+
| 24 |
+——————-+
1 row in set (0.00 sec)
mysql> SELECT BIT_LENGTH(NULL);
+——————+
| BIT_LENGTH(NULL) |
+——————+
| NULL |
+——————+
1 row in set (0.00 sec)
Below is the mysql terminal screen for above code :
See all MySQL String functions MySQL 8 String Functions.