[SQL] PROBLEM SET 1
Updated:
모든 문제의 출처는 해커랭크입니다. (https://www.hackerrank.com/domains/sql)
문제 1
code
SELECT NAME
FROM CITY
WHERE POPULATION > 120000 AND COUNTRYCODE = 'USA';
문제 2
code
SELECT *
FROM CITY
문제 3
code
SELECT *
FROM CITY
WHERE ID = '1661';
문제 4
code
SELECT *
FROM CITY
WHERE COUNTRYCODE = 'JPN';
문제 5
code
SELECT NAME
FROM CITY
WHERE COUNTRYCODE = 'JPN';
문제 6
code
SELECT CITY, STATE
FROM STATION;
문제 7
code
SELECT CITY
FROM STATION
WHERE MOD(ID,2) = 0
GROUP BY CITY;
문제 8
code
SELECT COUNT(CITY) - COUNT(DISTINCT CITY)
FROM STATION;
문제 9
code
SELECT CITY, LENGTH(CITY)
FROM STATION
ORDER BY LENGTH(CITY), CITY
LIMIT 1;
SELECT CITY, LENGTH(CITY)
FROM STATION
ORDER BY LENGTH(CITY) DESC, CITY
LIMIT 1
문제 10
code
SELECT CITY
FROM STATION
WHERE (
CITY LIKE 'E%'
OR CITY LIKE 'A%'
OR CITY LIKE 'I%'
OR CITY LIKE 'O%'
OR CITY LIKE 'U%'
);
Leave a comment