集合运算,层次查询

2017-12-17  本文已影响0人  鲁斯侨
select sal,job from emp where deptno=7839
union
select sal,job from emp_jobhistory where empno=7839
select sal,job from emp where deptno=7839
union all
select sal,job from emp_jobhistory where empno=7839

层次查询

select empno, ename, job, mgr
from emp 
start with empno = 7876
connect by prior mgr = empno

prior相当于 empno = 7876

select level ename ||'work for' ||
prior ename
from emp 
start with ename='KING'
connect by prior empno = mgr
order by level
上一篇下一篇

猜你喜欢

热点阅读