Given a table STATION that holds data for five fields namely ID, CITY, STATE, NORTHERN LATITUDE and WESTERN LONGITUDE.
Write a query to print shortest and longest cities name. If there are more than one cities print lexicographical smallest name.
+-------------+------------+| Field | Type |+-------------+------------+| ID | INTEGER || CITY | VARCHAR(21)|| STATE | VARCHAR(2) || LAT_N | NUMERIC || LONG_W | NUMERIC |+-------------+------------+
>>(select CITY, char_length(CITY) as len_city from STATION order by len_city limit 1) union all (select CITY, char_length(CITY) as len_city from STATION order by len_city desc limit 1) order by len_city;
Thanks.
Thanks.
SIMPLE AND EASY...MAST
ReplyDeleteThanks a lot :)
Delete