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
Release: 2023-08-29 15:41:07
forward
1142 people have browsed it

使用 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)
Copy after login

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

The syntax of CHARACTER_LENGTH

CHARACTER_LENGTH (Str)
Copy after login

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)
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template