The Blog


Find longest string in a column MySQL

Posted on
select name from daTable
where length(name) =
( select max(length(name)) from daTable )

How about the record that has the most number of words ? I am referring to MYSQL manual now, but still can’t find a solution for this.

SELECT lemma FROM word 
WHERE (LENGTH(lemma)-LENGTH(REPLACE(lemma,' ',''))) = 
(SELECT MAX(LENGTH(lemma)-LENGTH(REPLACE(lemma,' ',''))) FROM word);
Posted in MySQL Leave a comment
« Previous Page