We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Please read the question carefully.
Query the two cities in STATION with the shortest and longest CITY names, as well as their respective lengths (i.e.: number of characters in the name). If there is more than one smallest or largest city, choose the one that comes first when ordered alphabetically.
As you can see, there is a condition in the question that tells "If there is more than one smallest or largest city, choose the one that comes first when ordered alphabetically". "length(city) asc and desc" will order the names as asc and desc. But if there is more than one smallest or largest, then we have to order the names according to the city names alphabetically. That's why I have used the "city asc" in both the cases.
For limit please read the description that I have share before the query.
Thank You.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Weather Observation Station 5
You are viewing a single comment's thread. Return to all comments →
Please read the question carefully. Query the two cities in STATION with the shortest and longest CITY names, as well as their respective lengths (i.e.: number of characters in the name). If there is more than one smallest or largest city, choose the one that comes first when ordered alphabetically.
As you can see, there is a condition in the question that tells "If there is more than one smallest or largest city, choose the one that comes first when ordered alphabetically". "length(city) asc and desc" will order the names as asc and desc. But if there is more than one smallest or largest, then we have to order the names according to the city names alphabetically. That's why I have used the "city asc" in both the cases. For limit please read the description that I have share before the query. Thank You.