Lim Seunghyun Space

[HackerRank] Weather Observation Station 6 본문

SQL/SQL 문제

[HackerRank] Weather Observation Station 6

Lim Seung Hyun 2021. 11. 19. 14:37

문제 : https://www.hackerrank.com/challenges/weather-observation-station-6/problem?isFullScreen=true 

 

Weather Observation Station 6 | HackerRank

Query a list of CITY names beginning with vowels (a, e, i, o, u).

www.hackerrank.com

 

문제 해설

  • STATION 테이블에서 CITY 값이 a,e,i,o,u 로 시작하는 데이터를 조회
  • 조회하는 CITY는 중복제거

 

풀이 (MySQL)

SELECT DISTINCT(CITY)
FROM STATION
WHERE CITY LIKE "a%" or CITY LIKE "e%" or CITY LIKE "i%" or CITY LIKE "o%" or CITY LIKE "u%";
  • WHERE COLUMN LIKE "문자%" : (조건) COLUMN에서 문자로 시작되는 데이터
728x90