CHAR_LENGTH
Return the length of a string in characters. This function counts the number of characters in the string, treating multi-byte characters as single units.
Syntax
CHAR_LENGTH(str)
CHARACTER_LENGTH(str)Description
Examples
SELECT CHAR_LENGTH('MariaDB');
+------------------------+
| CHAR_LENGTH('MariaDB') |
+------------------------+
| 7 |
+------------------------+SELECT CHAR_LENGTH('π'), LENGTH('π'), LENGTHB('π'), OCTET_LENGTH('π');
+-------------------+--------------+---------------+--------------------+
| CHAR_LENGTH('π') | LENGTH('π') | LENGTHB('π') | OCTET_LENGTH('π') |
+-------------------+--------------+---------------+--------------------+
| 1 | 2 | 2 | 2 |
+-------------------+--------------+---------------+--------------------+See Also
Last updated
Was this helpful?

