๋ฌธ์
Query the list of CITY names ending with vowels (a, e, i, o, u) from STATION. Your result cannot contain duplicates.
๐ ๋์ ์ด๋ฆ์ด ๋ชจ์์ผ๋ก ๋๋๋ ๊ฒ๋ง ์ฐพ๊ธฐ (๋จ, ์ค๋ณต ํ์ฉ ์๋จ)
Input Format
The STATION table is described as follows:
ํ์ด
- ์ค๋ณต๊ฐ ์ ์ธํ๊ธฐ ์ํด DISTINCT
- ๋ง์ง๋ง ํ ๊ธ์๋ฅผ ์ง์ : RIGHT( ์ปฌ๋ผ๋ช , 1 )
- ๋ง์ง๋ง ํ ๊ธ์๊ฐ ๋ชจ์์ผ๋ก ๋๋๋ ๊ฒ : RIGHT( ์ปฌ๋ผ๋ช , 1 ) IN (๋ชจ์)
SELECT DISTINCT CITY
FROM STATION
WHERE RIGHT(CITY, 1) IN ('a', 'e', 'i', 'o', 'u')
์์ฉ
โถ๏ธ Weather Observation Station 7 : ์ฒซ ๊ธ์๊ฐ '๋ชจ์'์ผ๋ก ์์ํ์ง ์๋ ๋์๋ช ์ถ๋ ฅํ๊ธฐ(์ค๋ณต ์ ์ธ)
SELECT DISTINCT CITY
FROM STATION
WHERE LEFT(CITY, 1) NOT IN ('a', 'e', 'i', 'o', 'u')
728x90
'SQL > SQL test' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[HackerRank] Top Earners ํ์ด (mySQL) (1) | 2023.12.23 |
---|---|
[HackerRank] The Blunder ํ์ด (1) | 2023.12.23 |
[ํ๋ก๊ทธ๋๋จธ์ค] ์๋์ฐจ ๋์ฌ ๊ธฐ๋ก ๋ณ ๋์ฌ ๊ธ์ก ๊ตฌํ๊ธฐ (0) | 2023.10.13 |
[ํ๋ก๊ทธ๋๋จธ์ค] ์ฃผ๋ฌธ๋์ด ๋ง์ ์์ด์คํฌ๋ฆผ๋ค ์กฐํํ๊ธฐ (0) | 2023.10.09 |
[ํ๋ก๊ทธ๋๋จธ์ค] ์ํ๋ถ๋ฅ๋ณ ๊ฐ์ฅ ๋น์ผ ์ํ์ ์ ๋ณด ์กฐํํ๊ธฐ (1) | 2023.10.09 |