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 )位置没有影响。
left join 关联条件位置的更多相关文章
- SQL之Left Join 关联条件的探讨
在测试工作中,有时需要测试数据库数据经过sql计算后的结果是否满足某一功能查询得到的返回值. 针对某些需要功能需要联查多张表,此时 关联 的作用就异常重要了,而针对多表关联,其中 关联条件的重要性不言 ...
- JOIN关联表中ON,WHERE后面跟条件的区别
select * from td left join (select case_id as sup_case_id , count(*) supervise_number from td_kcdc ...
- left join 条件位置问题
表一:
- laravel4.2 union联合,join关联分组查询最新记录时,查询条件不对,解决方案
需求: 分组联合查询,或者最新记录. 问题: mysql分组的时候默认会查询第一条记录,存在gourp by时 order by 无效. 一般解决办法就是 ,select * from ( sele ...
- mysql 关联条件与查询(过滤)条件
mysql用outer join时 on 后边只是关联条件,有时可能会查出无用的记录, 需用where查询条件过滤 五欧诺个的数据. 记录一下
- PLSQL_性能优化系列02_Oracle Join关联
2014-09-25 Created By BaoXinjian
- TSQL:A表字段与B表中的关联,关联条件中一列是随机关联的实现方式
A表字段与B表中的关联,关联条件中一列是随机关联的实现方式 create table test( rsrp string, rsrq string, tkey string, distan strin ...
- oracle使用LEFT JOIN关联产生的问题在查询结果中使用CASE WHEN 无法判断
oracle使用LEFT JOIN关联产生的问题在查询结果中使用CASE WHEN 无法判断 查询方式一: SELECT CASE WHEN (SELECT CAST(SUM(CASE ) THEN ...
- 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 ...
随机推荐
- os即时通讯客户端开发之-mac上安装MySQL
一.安装 到MySQL官网上http://dev.mysql.com/downloads/mysql/,下载mysql可安装dmg版本 比如:Mac OS X ver. 10.7 (x86, 64-b ...
- Flashback Version Query、Flashback Transaction Query快速闪回细粒度数据
Flashback Version Query 闪回版本查询 使用Flashback Version Query 返回在指定时间间隔或SCN间隔内的所有版本,一次commit命令就会创建一个版本. ...
- 给Android程序猿的六个建议
假设你一年前写的代码 , 在如今看来你还感觉写的非常不错 , 那么说明你学习的不够多. 不要在Context中持有静态引用 public class MainActivity extends Loca ...
- 高仿“点触验证码”做的一个静态Html例子
先上源码: <html> <head> <title>TouClick - Designed By MrChu</title> <meta htt ...
- 初学JavaScript须知道的七件事
1.1.缩略标记 //定义对象 //var car = new Object(); //car.colour = 'red'; //car.wheels = 4; //car.hubcaps = 's ...
- hdu 2203
题意: 子串问题 水题,只要把母串*2,然后比较...... 感觉我好懒....没有自己写函数...... 反正我不是勤快的人......... AC代码: #include <iostream ...
- C#获取磁盘列表与信息
方法1:使用Environment //获取当前计算机逻辑磁盘名称列表 String[] drives = Environment.GetLogicalDrives(); Console.WriteL ...
- 记一次T-SQL查询优化 索引的重要性
概述 在一次调优一个项目组件的性能问题时,发现SQL的设计真的是非常的重要,所以写一篇博文来记录总结一下. 环境介绍 这个项目组件是一个Window服务,内部在使用轮循机会在处理一个事件表中的事件,将 ...
- Springmvc整合mybatis
http://blog.csdn.net/geloin/article/details/7536968 http://blog.csdn.net/woshi74/article/details/378 ...
- 有关Ajax实现的两种方法
首先我们来常见的Jquery式的Ajax写法,以及在java后台的取值 /** *AJAX */ function showLastTime(){ var facilityId = $('*[name ...