(相关资料图)
create view Vasselect ename,job,sal from emp where job = "CLERK"select * from VENAME JOB SAL---------- --------- ----------SMITH CLERK 800ADAMS CLERK 1100JAMES CLERK 950MILLER CLERK 1300
select e.empno,e.ename,e.job,e.sal,e.deptno from emp e join V on ( e.ename = v.ename and e.job = v.job and e.sal = v.sal )
select empno,ename,job,sal,deptno from emp where (ename,job,sal) in ( select ename,job,sal from emp intersect select ename,job,sal from V )
select deptno from dept where deptno not in (select deptno from emp)
select distinct deptno from deptwhere deptno not in (select deptno from emp)
select deptno from dept exceptselect deptno from emp
select deptno from dept minusselect deptno from emp
select deptno from dept where deptno not in ( 10,50,null )( no rows )select deptno from dept where not (deptno=10 or deptno=50 or deptno=null)( no rows )
select d.deptno from dept d where not exists ( select null from emp e where d.deptno = e.deptno )
select d.* from dept d left outer join emp e on (d.deptno = e.deptno) where e.deptno is null
select e.ename, d.loc, eb.received from emp e join dept d on (e.deptno=d.deptno) left join emp_bonus eb on (e.empno=eb.empno) order by 2
select e.ename, d.loc, (select eb.received from emp_bonus eb where eb.empno=e.empno) as received from emp e, dept d where e.deptno=d.deptno order by 2
select d.deptno,d.dname,e.ename from dept d full outer join emp e on (d.deptno=e.deptno)B
select d.deptno,d.dname,e.ename from dept d right outer join emp e on (d.deptno=e.deptno) union select d.deptno,d.dname,e.ename from dept d left outer join emp e on (d.deptno=e.deptno)
标签
Copyright ? 2015-2022 亚太粮油网版权所有 备案号:沪ICP备2020036824号-11 联系邮箱: 562 66 29@qq.com