Home >Database >Mysql Tutorial >What is the purpose of using MySQL CHAR_LENGTH() function? Which function is its synonym?
MySQL CHAR_LENGTH() is used to retrieve the length of a specified string. This function simply counts the number of characters, regardless of whether the characters are single-byte or multi-byte. The MySQL CHARACTER_LENGTH() function is its synonym. The syntax of these functions is as follows -
CHAR_LENGTH (Str)
Here, Str is the string whose length is to be obtained.
CHARACTER_LENGTH (Str)
Here, Str is the string to get the length.
mysql> Select CHAR_LENGTH('tutorialspoint'); +-------------------------------+ | CHAR_LENGTH('tutorialspoint') | +-------------------------------+ | 14 | +-------------------------------+ 1 row in set (0.03 sec) mysql> Select CHARACTER_LENGTH('tutorialspoint'); +------------------------------------+ | CHARACTER_LENGTH('tutorialspoint') | +------------------------------------+ | 14 | +------------------------------------+ 1 row in set (0.00 sec)
The above is the detailed content of What is the purpose of using MySQL CHAR_LENGTH() function? Which function is its synonym?. For more information, please follow other related articles on the PHP Chinese website!