Find the length of the longest string in MySQL
by Rekha[ Edit ] 2010-01-28 14:15:31
The LENGTH() function in MySQL returns the length of a string in bytes. Multi-byte characters will count as multiple bytes. The example uses the LENGTH() function but you can substitute them with the CHAR_LENGTH() function instead if you want to count the number of characters rather than bytes.
SELECT LENGTH('this is a test');
This will return the number 14.