This tutorial explains how to use the MySQL CHAR_LENGTH function with syntax and examples.
The MySQL CHAR_LENGTH function returns the length of the specified string (measured in characters).
The syntax for the CHAR_LENGTH function in MySQL is:
CHAR_LENGTH( string )
The string to return the length for.
The CHAR_LENGTH function can be used in the following versions of MySQL:
Let's look at some MySQL CHAR_LENGTH function examples and explore how to use the CHAR_LENGTH function in MySQL.
For example:
mysql> SELECT CHAR_LENGTH(NULL);
Output: NULL
mysql> SELECT CHAR_LENGTH('');
Output: 0
mysql> SELECT CHAR_LENGTH(' ');
Output: 1
mysql> SELECT CHAR_LENGTH('AODBA.com');
Output: 9