1. https://www.hackerrank.com/challenges/revising-the-select-query-2/problem?isFullScreen=true
Q: Query the NAME field for all American cities in the CITY table with populations larger than 120000. The CountryCode for America is USA.
The CITY table is described as follows:
A:
SELECT name
FROM city
WHERE population > 120000 AND CountryCode = 'USA'
2. https://www.hackerrank.com/challenges/japanese-cities-attributes/problem?isFullScreen=true
Q: Query all attributes of every Japanese city in the CITY table.
The COUNTRYCODE for Japan is JPN.
The CITY table is described as follows:
A:
SELECT *
FROM city
WHERE countrycode = 'JPN'
3. https://www.hackerrank.com/challenges/japanese-cities-name/problem?isFullScreen=true
Q: Query the names of all the Japanese cities in the CITY table.
The COUNTRYCODE for Japan is JPN.
The CITY table is described as follows:
A:
SELECT name
FROM city
WHERE countrycode = 'JPN'
4. https://www.hackerrank.com/challenges/weather-observation-station-11/problem
Q: Query the list of CITY names from STATION that either do not start with vowels or do not end with vowels. Your result cannot contain duplicates.
Input Format
The STATION table is described as follows:
A:
SELECT DISTINCT city
FROM station
WHERE (city NOT LIKE 'a%'
AND city NOT LIKE 'e%'
AND city NOT LIKE 'i%'
AND city NOT LIKE 'o%'
AND city NOT LIKE 'u%')
OR (city NOT LIKE '%a'
AND city NOT LIKE '%e'
AND city NOT LIKE '%i'
AND city NOT LIKE '%o'
AND city NOT LIKE '%u')
- 어려워서 해설 참조함..ㅜ
'SQL' 카테고리의 다른 글
MySQL 정규표현식 REGEXP + 해커랭크 예제 풀이 (0) | 2023.06.29 |
---|---|
ORDER BY/LEFT/RIGHT/SUBSTR/CEIL/FLOOR/ROUND + 해커랭크 예제 풀이 (0) | 2023.06.26 |
WHERE문 해커랭크 예제 풀이(DISTINCT, NOT LIKE) (0) | 2023.06.22 |
LIKE/IN/BETWEEN/IS NULL (0) | 2023.06.20 |
WHERE/AND/OR (0) | 2023.06.20 |