Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- coding
- leetcode
- github
- 클라우드컴퓨팅
- L1정규화
- conflict
- sql
- hackerrank
- branch
- window function
- 코딩공부
- 온라인협업
- Git
- RLIKE
- HTML
- programmers
- mysql
- 버전충돌
- L2정규화
- 깃헙협업
- CSS
- elastic net
- merge
- AWS
- 편향-분산 교환
- 교차 엔트로피
- full request
- 선형 모형
- PYTHON
- early stopping
Archives
- Today
- Total
Im between cherry
Hackerrank | MySQL | Weather Observation Station 5 본문
Weather Observation Station 5
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
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.
The STATION table is described as follows:
Solution
(SELECT CITY, LENGTH(CITY)
FROM STATION
ORDER BY LENGTH(CITY) ASC, CITY
LIMIT 1)
UNION
(SELECT CITY, LENGTH(CITY)
FROM STATION
ORDER BY LENGTH(CITY) DESC, CITY
LIMIT 1)
'데이터분석 > practice_query' 카테고리의 다른 글
Hackerrank | MySQL | Weather Observation Station 7 (0) | 2020.08.27 |
---|---|
Hackerrank | MySQL | Weather Observation Station 6 (0) | 2020.08.27 |
Hackerrank | MySQL | Weather Observation Station 4 (0) | 2020.08.27 |
Hackerrank | MySQL | Weather Observation Station 3 (0) | 2020.08.27 |
Hackerrank | MySQL | Weather Observation Station 1 (0) | 2020.08.27 |
Comments