LENGTH() FUNCTION in MySQL

LENGTH() FUNCTION
The MySQL LENGTH function is used to get the length of the specified string in bytes. The various versions of MySQL support the 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() FUNCTION in MySQL

Parameters:
string: It is used to specify the string to evaluate.

Example 1:

mysql> SELECT LENGTH (‘letsbefriends’);

Output:

13

Explanation:
The number of bytes is 13 in the specified string.