[SQL] PROBLEM SET 2
Updated:
모든 문제의 출처는 해커랭크입니다. (https://www.hackerrank.com/domains/sql)
문제 1
code
SELECT DISTINCT CITY
FROM STATION
WHERE CITY LIKE '%a'
OR CITY LIKE '%e'
OR CITY LIKE '%i'
OR CITY LIKE '%o'
OR CITY LIKE '%u';
문제 2
code
SELECT CITY
FROM STATION
WHERE LEFT(CITY,1) IN ('a','e','i','o','u') AND RIGHT(CITY,1) IN ('a','e','i','o','u');
문제 3
code
SELECT DISTINCT CITY
FROM STATION
WHERE NOT LEFT(CITY,1) IN ('a','e','i','o','u');
문제 4
code
SELECT DISTINCT CITY
FROM STATION
WHERE NOT RIGHT(CITY,1) IN ('a','e','i','o','u');
문제 5
code
SELECT DISTINCT CITY
FROM STATION
WHERE NOT LEFT(CITY,1) IN ('a','e','i','o','u') OR NOT RIGHT(CITY,1) IN ('a','e','i','o','u');
문제 6
code
SELECT DISTINCT CITY
FROM STATION
WHERE NOT LEFT(CITY,1) IN ('a','e','i','o','u') AND NOT RIGHT(CITY,1) IN ('a','e','i','o','u');
문제 7
code
SELECT NAME
FROM STUDENTS
WHERE MARKS > 75
ORDER BY RIGHT(NAME,3), ID;
문제 8
code
SELECT NAME
FROM Employee
ORDER BY NAME;
문제 9
code
SELECT name
FROM Employee
WHERE salary > 2000 AND months < 10
ORDER BY employee_id;
문제 10
code
Leave a comment