SQL_Basic_Select_3

Gino·2022년 3월 18일
1

SQL #1 문제풀이

목록 보기
13/35

문제출처 HACKER RANK
문제의 저작권은 해커랭크에 있습니다

-- Weather Observation Station 6
-- 'a','e','i','o','u'로 시작하는 도시 찾기
SELECT DISTINCT CITY FROM STATION
WHERE LEFT(CITY,1) IN ('a','e','i','o','u');

-- Weather Observation Station 7
-- 'a','e','i','o','u'로 끝나는 도시 찾기
SELECT DISTINCT CITY FROM STATION
WHERE RIGHT(CITY,1) IN ('a','e','i','o','u');

-- Weather Observation Station 8
-- 'a','e','i','o','u'로 시작하거나 끝나는 도시 찾기 
SELECT DISTINCT CITY FROM STATION
WHERE LEFT(CITY,1) IN ('a','e','i','o','u')
AND RIGHT(CITY,1) IN ('a','e','i','o','u');

-- Weather Observation Station 9
-- 모음으로 시작하지 않는 도시 찾기
SELECT DISTINCT CITY FROM STATION
WHERE LEFT(CITY,1) NOT IN ('a','e','i','o','u');

-- Weather Observation Station 10
-- 'a','e','i','o','u'로 끝나지 않는 도시 찾기
SELECT DISTINCT CITY FROM STATION
WHERE RIGHT(CITY,1) NOT IN ('a','e','i','o','u');

-- Weather Observation Station 11
-- 'a','e','i','o','u'로 시작하지 않거나 끝나지 않는 도시 찾기 
SELECT DISTINCT CITY FROM STATION
WHERE LEFT(CITY,1) NOT IN ('a','e','i','o','u')
OR RIGHT(CITY,1) NOT IN ('a','e','i','o','u');

-- Weather Observation Station 12
-- 'a','e','i','o','u'로 시작하지 않고, 끝나지 않는 도시 찾기 
SELECT DISTINCT CITY FROM STATION
WHERE LEFT(CITY,1) NOT IN ('a','e','i','o','u')
AND RIGHT(CITY,1) NOT IN ('a','e','i','o','u');
profile
나무를 심는 사람

0개의 댓글