SELECT *
FROM DEPT
WHERE DEPT IN (SELECT DEPTNO FROM EMP)
create index emp_x01 on emp(deptno);
dept컬럼은 null가능
select *
from emp
order by deptno
select deptno, sum(sal+nvl(comm,0))
from emp
group by deptno
SELECT FROM EMP WHERE MGR= 7839
UNION
SELECT FROM EMP WHERE MGR = 7566
SELECT *
FROM DEPT
WHERE DEPTNO IN (SELECT DEPTNO FROM EMP)
SELECT /*+ LEADING(D) */
FROM DEPT D
WHERE EXISTS (SELECT /*+ UNNEST NL_SJ */ 'X' FROM EMP WHERE DEPTNO = D.DEPTNO)
SELECT A.
FROM (
SELECT ROWNUM RN
, A.
FROM (
SELECT *
FROM EMP_100000
ORDER BY ENAME DESC
) A
WHERE ROWNUM <= 10 --이구문이 핵심
)A
WHERE A.RN >= 1