Skip to main content
Version: V1.1.0

LENGTH

Syntax​

LENGTH(str)

Description​

Returns the length of str in bytes.

Each multibyte character is counted as multiple characters. For example, if the input is 5 two-byte characters, CHAR_LENGTH() returns 5, while LENGTH() returns 10.

Examples​

SELECT LENGTH('China'), LENGTH('hello');
+------------------+-----------------+
| LENGTH('China') | LENGTH('hello') |
+------------------+-----------------+
| 6 | 5 |
+------------------+-----------------+
1 row in set (0.001 sec)