[MySQL] Hackerrank SQL 연습문제 (1)
SQL Übung - Hackerrank
- SQL 문제 풀이를 통한 SQL 연습
Revising the Select Query I
- 10/11/2021
SELECT *
FROM city
WHERE countrycode="USA"
AND population > 100000
Revising the Select Query II
- 10/11/2021
SELECT name
FROM city
WHERE population > 120000
AND countrycode="USA";
Select All
- 10/11/2021
SELECT *
FROM city;
Select By ID
- 10/11/2021
SELECT *
FROM city
WHERE id = 1661;
Japanese Cities’ Attributes
- 11/11/2021
SELECT *
FROM city
WHERE countrycode = 'JPN';
Japanese Cities’ Names
- 11/11/2021
SELECT name
FROM city
WHERE countrycode = 'JPN'
Weather Observation Station 1
- 11/11/2021
SELECT city, state
FROM station;
Weather Observation Station 3
- 11/11/2021
SELECT DISTINCT(city)
FROM station
WHERE ID % 2 = 0;
Weather Observation Station 4
- 11/11/2021
SELECT COUNT(*) - COUNT(DISTINCT(city))
FROM station;
Weather Observation Station 5
- 11/11/2021
(SELECT city, LENGTH(city)
FROM station
ORDER BY LENGTH(city) ASC, city
LIMIT 1)
UNION
(SELECT city, LENGTH(city)
FROM station
ORDER BY LENGTH(city) DESC, city
LIMIT 1)