Home >Database >Mysql Tutorial >What is the purpose of using MySQL CHAR_LENGTH() function? Which function is its synonym?

What is the purpose of using MySQL CHAR_LENGTH() function? Which function is its synonym?

WBOY
WBOYforward
2023-08-29 15:41:071137browse

使用 MySQL CHAR_LENGTH() 函数的目的是什么?哪个函数是它的同义词?

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 syntax

CHAR_LENGTH (Str)

Here, Str is the string whose length is to be obtained.

The syntax of CHARACTER_LENGTH

CHARACTER_LENGTH (Str)

Here, Str is the string to get the length.

Example

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!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete