융무의 기술블로그
article thumbnail

https://www.hackerrank.com/challenges/weather-observation-station-5/problem?h_r=next-challenge&h_v=zen&h_r=next-challenge&h_v=zen

 

Weather Observation Station 5 | HackerRank

Write a query to print the shortest and longest length city name along with the length of the city names.

www.hackerrank.com

select CITY, LENGTH(CITY)
from STATION
ORDER BY LENGTH(CITY), CITY
LIMIT 1;

select CITY, LENGTH(CITY)
from STATION
ORDER BY LENGTH(CITY) DESC, CITY
LIMIT 1;

choose the one that comes first이므로 내림차순으로 정렬한뒤에 LIMIT를 사용해서 1개만 불러온다.

 

profile

융무의 기술블로그

@융무

포스팅이 좋았다면 "좋아요❤️" 또는 "구독👍🏻" 해주세요!