/// 계층적 질의 문
select empno,ename,mgr,LEVEL
from emp
start with ename='SCOTT' or ename='BLAKE' or ename='KING'
connect by prior empno=mgr;
// 인라인 뷰를 이용한 rownum 사용법
select *
from emp a, (select sal, rownum as num
from (select sal
from emp
where deptno = 10
order by sal)) b
where b.num = 2
and a.sal = b.sal
/
select max(dname), b.deptno, sum(sal) from emp a, dept b
where a.deptno = b.deptno
group by rollup(b.deptno)'Oracle > 특정 쿼리' 카테고리의 다른 글
달력 쿼리 (0) | 2011.03.24 |
---|---|
구구단 쿼리(plsql) (0) | 2011.03.24 |