--9강 연습문제
--1번
SELECT JOB,EMPNO,ENAME,SAL,DEPTNO,DNAME
FROM EMP NATURAL JOIN DEPT
WHERE JOB = (SELECT JOB FROM EMP
WHERE ENAME = 'ALLEN');
--2번
SELECT EMPNO,ENAME,DNAME,HIREDATE,LOC,SAL,GRADE
FROM EMP NATURAL JOIN DEPT , SALGRADE
WHERE SAL > (SELECT AVG(SAL) FROM EMP)
AND SAL BETWEEN LOSAL AND HISAL
ORDER BY SAL DESC,EMPNO;
--3번
SELECT EMPNO,ENAME,JOB,DEPTNO,DNAME,LOC
FROM EMP NATURAL JOIN DEPT
WHERE DNAME IN(SELECT DNAME FROM EMP
WHERE DNAME = 'ACCOUNTING')
AND ENAME = 'KING';
--4번
SELECT EMPNO,ENAME,SAL,GRADE
FROM EMP NATURAL JOIN SALGRADE
WHERE SAL > ALL(SELECT SAL FROM EMP
WHERE JOB = 'SALESMAN')
AND SAL BETWEEN LOSAL AND HISAL
ORDER BY EMPNO;
'오라클 SQL' 카테고리의 다른 글
오라클 SQL 12강 (0) | 2021.03.02 |
---|---|
오라클 SQL 210302 연습문제 (0) | 2021.03.02 |
오라클 SQL 8강 연습문제 (0) | 2021.03.02 |
오라클 SQL 10강 연습문제 (0) | 2021.03.02 |
오라클 SQL 11강 (0) | 2021.03.02 |