RBO和CBO下的NOTIN/NOTEXISTS与外关联

<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 728x15, 创建于 08-4-23MSDN */ google_ad_slot = "3624277373"; google_ad_width = 728; google_ad_height = 15; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 160x600, 创建于 08-4-23MSDN */ google_ad_slot = "4367022601"; google_ad_width = 160; google_ad_height = 600; //--> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>

SQL>analyzetablescott.empcomputestatisticsfortableforallcolumns;

表已分析。

已用时间: 00:00:06.06

SQL>select*fromscott.empe 2 wheree.empnoNOTIN(selectmgrfromscott.emp);

未选定行

已用时间: 00:00:00.00

ExecutionPlan----------------------------------------------------------                                           0     SELECTSTATEMENTOptimizer=CHOOSE(Cost=4Card=1Bytes=32)                                 1   0  FILTER                                                                                   2   1    TABLEACCESS(FULL)OF'EMP'(Cost=2Card=1Bytes=32)                                  3   1    TABLEACCESS(FULL)OF'EMP'(Cost=2Card=1Bytes=3)                                 



SQL>SQL>select*fromscott.empe 2 whereNOTEXISTS(selectnullfromscott.empswheres.mgr=e.empno);

    EMPNOENAME     JOB             MGRHIREDATE         SAL      COMM    DEPTNO             -------------------------------------------------------------------------------                  7844TURNER    SALESMAN       769808-9月-81      1500         0        30                  7521WARD      SALESMAN       769822-2月-81      1250       500        30                  7654MARTIN    SALESMAN       769828-9月-81      1250      1400        30                  7499ALLEN     SALESMAN       769820-2月-81      1600       300        30                  7934MILLER    CLERK          778223-1月-82      1300                   10                  7369SMITH     CLERK          790217-12月-80       800                   20                  7876ADAMS     CLERK          778823-5月-87      1100                   20                  7900JAMES     CLERK          769803-12月-81       950                   30             1 <script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 728x15, 创建于 08-4-23MSDN */ google_ad_slot = "3624277373"; google_ad_width = 728; google_ad_height = 15; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
<script type="text/javascript"><!-- google_ad_client = "pub-2947489232296736"; /* 160x600, 创建于 08-4-23MSDN */ google_ad_slot = "4367022601"; google_ad_width = 160; google_ad_height = 600; //--> </script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script>
阅读更多
文章标签: filter
个人分类: 数据库
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭