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 )位置没有影响。
    
    

  • 相关阅读:
    Python学习 Day 068
    Python模块(一)(常用模块)
    python面向对象(C3算法)(六)
    Python面向对象(约束,异常处理,md5加密)(五)
    python面向对象(反射)(四)
    Python面向对象(类之间的关系)(三)
    Python面向对象(成员)(二)
    python面向对象(一)
    Python函数的装饰器
    递归与二分法
  • 原文地址:https://www.cnblogs.com/zhaoyangjian724/p/3797883.html
Copyright © 2011-2022 走看看