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

left join 关联条件位置的更多相关文章

  1. SQL之Left Join 关联条件的探讨

    在测试工作中,有时需要测试数据库数据经过sql计算后的结果是否满足某一功能查询得到的返回值. 针对某些需要功能需要联查多张表,此时 关联 的作用就异常重要了,而针对多表关联,其中 关联条件的重要性不言 ...

  2. JOIN关联表中ON,WHERE后面跟条件的区别

    select * from td  left join (select case_id as sup_case_id , count(*) supervise_number from  td_kcdc ...

  3. left join 条件位置问题

    表一:

  4. laravel4.2 union联合,join关联分组查询最新记录时,查询条件不对,解决方案

    需求: 分组联合查询,或者最新记录. 问题:  mysql分组的时候默认会查询第一条记录,存在gourp by时 order by 无效. 一般解决办法就是 ,select * from ( sele ...

  5. mysql 关联条件与查询(过滤)条件

    mysql用outer join时 on 后边只是关联条件,有时可能会查出无用的记录, 需用where查询条件过滤 五欧诺个的数据. 记录一下

  6. PLSQL_性能优化系列02_Oracle Join关联

    2014-09-25 Created By BaoXinjian

  7. TSQL:A表字段与B表中的关联,关联条件中一列是随机关联的实现方式

    A表字段与B表中的关联,关联条件中一列是随机关联的实现方式 create table test( rsrp string, rsrq string, tkey string, distan strin ...

  8. oracle使用LEFT JOIN关联产生的问题在查询结果中使用CASE WHEN 无法判断

    oracle使用LEFT JOIN关联产生的问题在查询结果中使用CASE WHEN 无法判断 查询方式一: SELECT CASE WHEN (SELECT CAST(SUM(CASE ) THEN ...

  9. hive join on 条件 与 where 条件区别

    1. select * from a left join b on a.id = b.id and a.dt=20181115; 2. select * from a left join b on a ...

随机推荐

  1. Object-C 点语法 -- 笔记

    第一种是经典方式, 第一种是点语法.

  2. Android Toast 自定义

    <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android=&quo ...

  3. 使用jcrop进行头像剪切

    http://www.cnblogs.com/chenssy/archive/2013/05/18/3084985.html http://code.ciaoca.com/jquery/jcrop/ ...

  4. GSON 示例代码 实用版

    去除所有格式的json字符串 {"data":[{"friend":[{"address":"广州","nam ...

  5. Fragment 创建 传递参数 跳转 典例

    抽取的控制Fragment的父Activity /**  * 抽象一个Activity托管我们的Single Fragment  */ public abstract class SingleFrag ...

  6. 文本溢出、垂直外边距合并、BFC、hasLayout

    今天学习文本溢出,又遇到了一些小问题,先上图: 关于文本溢出推荐:http://www.cnblogs.com/yzg1/p/5089534.html 从里面学习到单行文本和多行文本溢出, overf ...

  7. JAVA小项目之摇奖机

    功能: 点击”摇杆“开始: 两种结束滚动方式,A:点击”摇杆“ B:分别点击 对应结果框的按钮: 实现最后减速停下来效果,模拟真实摇奖机. 知识点:A.线程的控制,B.图片轮播原理 效果图:   窗口 ...

  8. js和php判断当前是否为微信浏览器?

  9. tips [终端]

    pbcopy 命令:Place standard output in the clipboard. $ pbcopy < ~/.ssh/id_rsa.pub

  10. js获取当前事件键盘按钮

    用户名:<input type="text" name="username" id="username"><br /> ...