Query shorted and longest cities


If two shorted city like AMO,DIO, then display the one which come first in alphabetic order, here AMO

Not the best, union can also we used.


select  *  from (select city,CHAR_LENGTH(city) as citylen from station order by citylen,city ASC) T1 limit 1 ;
select  *  from (select city,CHAR_LENGTH(city) as citylen from station order by citylen DESC) T1
limit 1;  

Comments

Popular posts from this blog

Oracle User vs Oracle Schemas

Having and Where Clause