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
This is another way of doing it in MySQL. May not be the best, but still be an option that is logically correct.
select
city,
length(city)
from
station
where
length(city) in
(
select
max(length(city))
from
station
union
select
min(length(city))
from
station
)
order by
length(city) desc,
city asc limit 2;