You are viewing a single comment's thread. Return to all comments →
what is the need of 'city' after lenght(city) in the statement?
similary after length(city) desc, city.. why ?
SELECT * FROM(SELECT CITY, LENGTH(CITY) FROM STATION ORDER BY LENGTH(CITY),CITY) WHERE ROWNUM = 1; SELECT * FROM(SELECT CITY, LENGTH(CITY) FROM STATION ORDER BY LENGTH(CITY) DESC,CITY) WHERE ROWNUM = 1;
AFTER ORDERING FOR LENGTH IN ASC ORDER, YOU ALSO NEED TO ORDER THE CITIES ALPHABETICALLY.
If you dont mention any order, by default is Ascending order. So that query is right.
can you explain how it is working without the min and max ?
you are ordering it and limiting it to a single row hence your aim is fulfilled.