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