I have a table with one of the columns is of type varchar(city). and want to find the longest and shortest of values stored in that column.
select a.city, a.city
In Oracle:
select * from (select city, min(length(city)) minl from station group by city order by minl, city) where rownum = 1; select * from (select city, max(length(city)) maxl from station group by city order by maxl desc, city) where rownum = 1;