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

  • 相关阅读:
    SPComm的一点小诀窍 spcomm的问题导致数据丢失 0x11与0x13错误
    关于DELPHI数组,指针,字符串转换的例子!(转)
    SQL常用语法大全
    SQL触发器实例讲解
    Delphi 变体类型(Variant)的介绍(流与变体类型的相互转换、变体类型常用的函数)
    delphi 生成条形码(fastreport 实现)
    delphi 判断字符串有中文
    delphi const
    delphi as
    delphi 字符串常识
  • 原文地址:https://www.cnblogs.com/zhaoyangjian724/p/3797883.html
Copyright © 2020-2023  润新知