쌓고 쌓다

오라클 중심의 SQL 배움터 5장 연습문제 풀이 본문

프로그래밍/SQL

오라클 중심의 SQL 배움터 5장 연습문제 풀이

승민아 2022. 11. 2. 19:12

1번

SELECT name, grade, height FROM student WHERE height > 170 ORDER BY height DESC;

 

2번

SELECT name, userid, grade FROM student WHERE deptno=101 ANd grade>='3';

 

3번

-- 비교 연산자
SELECT name, grade, height FROM student WHERE height >= 165 AND height <= 175;

-- SQL 연산자
SELECT name, grade, height FROM student WHERE height BETWEEN 165 AND 175;

 

4번

SELECT name, userid, deptno FROM student WHERE name LIKE '이%';

 

5번

SELECT deptno FROM professor
MINUS
SELECT deptno FROM student;

 

6번

SELECT name, sal, deptno
FROM professor WHERE comm IS NULL;

 

7번

SELECT profno, name, sal, comm
FROM professor ORDER BY sal DESC;

 

8번 

SELECT profno, name, sal, sal*12, deptno
FROM professor ORDER BY deptno DESC, sal*12 ASC;

 

9번

SELECT name, sal, comm
FROM professor
WHERE sal >= 300 AND comm IS NOT NULL OR sal >= 450;

 

10번

SELECT profno "NO", name
FROM professor
WHERE deptno=201
UNION
SELECT studno, name
FROM student
WHERE deptno=201

 

Comments