www.hackerrank.com/challenges/weather-observation-station-5/problem
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
Answer
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;
www.hackerrank.com/challenges/weather-observation-station-6/problem
Weather Observation Station 6 | HackerRank
Query a list of CITY names beginning with vowels (a, e, i, o, u).
www.hackerrank.com
select city
from station
where city regexp '^[aeiou]'
정규표현식을 사용한다.
MySQL에서 정규표현식은 regexp이다.
728x90
반응형
'SQL & DB > HackerRank SQL Problem' 카테고리의 다른 글
[HackerRank SQL] Weather Observation Station 11, 12(MySQL) (0) | 2021.02.27 |
---|---|
[HackerRank SQL] Weather Observation Station 9, 10(MySQL) (0) | 2021.02.27 |
[HackerRank SQL] Weather Observation Station 7, 8(MySQL) (0) | 2021.02.27 |
[HackerRank SQL] Weather Observation Station 3, 4(MySQL) (0) | 2021.02.27 |
[HackerRank SQL] Weather Observation Station 1, 2 (MySQL) (0) | 2021.02.27 |