CHARACTER_LENGTH() FUNCTION
The MySQL CHARACTER_LENGTH function is used to get the length of the character in the specified string. The various versions of MySQL support the CHARACTER_LENGTH function, namely, MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0 and MySQL 3.23.
Syntax:
CHARACTER_LENGTH( string )
Parameters:
Strong>string: It is used to specify the string to evaluate.
Example 1:
mysql> SELECT CHARACTER_LENGTH ( ‘Sum of 2 and 4 is 6’);
Output:
19
Explanation:
The number of characters is 19 in the specified string.
Example 2:
mysql> SELECT CHARACTER_LENGTH (‘letsbefriends’);
Output:
13
Explanation:
The number of characters is 13 in the specified string.