exists改為內連線

lawzjf發表於2007-10-29

SQL> select dname from dept
2 where exists(select * from emp where deptno=dept.deptno)
3 /

DNAME
--------------
RESEARCH
SALES
ACCOUNTING


SQL> select distinct d.dname from dept d, emp e
2 where d.deptno=e.deptno
3 /

DNAME
--------------
ACCOUNTING
RESEARCH
SALES


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/37724/viewspace-152654/,如需轉載,請註明出處,否則將追究法律責任。

相關文章