应该这样吧
select empno,ename,job,sal
from scott.emp
where exists(select 'x' from scott.dept where scott.dept.deptno=scott.emp.deptno);相当于:
select empno,ename,job,sal
from scott.emp
where deptno in (select deptno from scott.dept);
select empno,ename,job,sal
from scott.emp
where exists(select 'x' from scott.dept where scott.dept.deptno=scott.emp.deptno);相当于:
select empno,ename,job,sal
from scott.emp
where deptno in (select deptno from scott.dept);
select emp.empno,emp.ename,emp.job,emp.sal
from scott.emp,scott.dept
where exists(select 1 from scott.emp where scott.dept.deptno=scott.emp.deptno);
效果会更好。