We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
MYSQL:
WITH VowelCities AS (
SELECT DISTINCT CITY,
ROW_NUMBER() OVER (PARTITION BY CITY ORDER BY CITY) AS rn
FROM STATION
WHERE NOT
(UPPER(CITY) LIKE 'A%'
OR UPPER(CITY) LIKE 'E%'
OR UPPER(CITY) LIKE 'I%'
OR UPPER(CITY) LIKE 'O%'
OR UPPER(CITY) LIKE 'U%')
OR NOT
(UPPER(CITY) LIKE '%A'
OR UPPER(CITY) LIKE '%E'
OR UPPER(CITY) LIKE '%I'
OR UPPER(CITY) LIKE '%O'
OR UPPER(CITY) LIKE '%U')
)
SELECT CITY
FROM VowelCities
WHERE rn = 1;
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Weather Observation Station 11
You are viewing a single comment's thread. Return to all comments →
MYSQL: WITH VowelCities AS ( SELECT DISTINCT CITY, ROW_NUMBER() OVER (PARTITION BY CITY ORDER BY CITY) AS rn FROM STATION WHERE NOT (UPPER(CITY) LIKE 'A%' OR UPPER(CITY) LIKE 'E%' OR UPPER(CITY) LIKE 'I%' OR UPPER(CITY) LIKE 'O%' OR UPPER(CITY) LIKE 'U%') OR NOT (UPPER(CITY) LIKE '%A' OR UPPER(CITY) LIKE '%E' OR UPPER(CITY) LIKE '%I' OR UPPER(CITY) LIKE '%O' OR UPPER(CITY) LIKE '%U') ) SELECT CITY FROM VowelCities WHERE rn = 1;