zoukankan      html  css  js  c++  java
  • left join 关联条件位置

    select e.last_name, e.department_id, d.department_name
      from hr.employees e
      left outer join hr.departments d on (e.department_id = d.department_id);
      
      
    select e.last_name, e.department_id, d.department_name
      from hr.employees e
      left outer join hr.departments d on ( d.department_id=e.department_id );
    
    
    
    SQL> select e.last_name, e.department_id, d.department_name
      from hr.employees e
      left outer join hr.departments d on (e.department_id = d.department_id);  2    3  
    
    107 rows selected.
    
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 2296652067
    
    ----------------------------------------------------------------------------------
    | Id  | Operation	   | Name	 | Rows  | Bytes | Cost (%CPU)| Time	 |
    ----------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT   |		 |   107 |  2889 |     7  (15)| 00:00:01 |
    |*  1 |  HASH JOIN OUTER   |		 |   107 |  2889 |     7  (15)| 00:00:01 |
    |   2 |   TABLE ACCESS FULL| EMPLOYEES	 |   107 |  1177 |     3   (0)| 00:00:01 |
    |   3 |   TABLE ACCESS FULL| DEPARTMENTS |    27 |   432 |     3   (0)| 00:00:01 |
    ----------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       1 - access("E"."DEPARTMENT_ID"="D"."DEPARTMENT_ID"(+))
    
    
    SQL> select e.last_name, e.department_id, d.department_name
      from hr.employees e
      left outer join hr.departments d on ( d.department_id=e.department_id );  2    3  
    
    107 rows selected.
    
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 2296652067
    
    ----------------------------------------------------------------------------------
    | Id  | Operation	   | Name	 | Rows  | Bytes | Cost (%CPU)| Time	 |
    ----------------------------------------------------------------------------------
    |   0 | SELECT STATEMENT   |		 |   107 |  2889 |     7  (15)| 00:00:01 |
    |*  1 |  HASH JOIN OUTER   |		 |   107 |  2889 |     7  (15)| 00:00:01 |
    |   2 |   TABLE ACCESS FULL| EMPLOYEES	 |   107 |  1177 |     3   (0)| 00:00:01 |
    |   3 |   TABLE ACCESS FULL| DEPARTMENTS |    27 |   432 |     3   (0)| 00:00:01 |
    ----------------------------------------------------------------------------------
    
    Predicate Information (identified by operation id):
    ---------------------------------------------------
    
       1 - access("D"."DEPARTMENT_ID"(+)="E"."DEPARTMENT_ID")
    
    
     (e.department_id = d.department_id)和( d.department_id=e.department_id )位置没有影响。
    
    

  • 相关阅读:
    链路层Introduce
    网络扫描常用命令
    SYN DDOS 防御策略
    Python学习笔记(三)------列表
    Python3.4学习笔记(二)------逻辑操作符,循环体,分支
    Python学习笔记(一)------安装,常识普及
    PHP学习日志一----------web开发 环境安装
    ubuntu中 给chrome安装adobe flash player
    Openwrt折腾日志(二)----------环境搭建及依赖安装
    Openwrt折腾日志(一)----------简介及ubuntu安装
  • 原文地址:https://www.cnblogs.com/zhaoyangjian724/p/3797883.html
Copyright © 2011-2022 走看看