ORACLE中用EXISTS代替DISTINCT的疑问? 最近看到ORACLE优化的一点建议,其中一点是用EXISTS代替DISTINCT,并给出例子: ------------DISTINCT------------------ select distinct d.deptno,d.dname from dept d,emp e where d.deptno = e.deptno;
------------EXISTS------------------ SELECT D.DEPTNO,D.DNAME FROM DEPT D WHERE EXISTS (SELECT 'X' FROM EMP E WHERE E.DEPTNO = D.DEPTNO);