Oracle中 in、exists、not in,not exists的比较
最基本的区别:
- in 对主表使用索引
- exists 对子表使用索引
- not in 不使用索引
- not exists 对主子表都使用索引
写法:
- exist的where条件是: "...... where exist (..... where a.id=b.id)"
- in的where条件是: " ...... where id in ( select id .... where a.id=b.id)"
BUG【要特别注意】:
这是用来举例的表

IN【正常】、NOT IN【不正常】的情况
IN【正常】

实际转换为执行的SQL等价于

NOT IN【不正常】
实际转换为执行的SQL等价于

修改SQL

Oracle中 in、exists、not in,not exists的比较的更多相关文章
- oracle中的not in和not exists注意事项
NOT IN:不包括空值 NOT EXISTS:包括空值
- Oracle中没有 if exists(...)
对于Oracle中没有 if exists(...) 的语法,目前有许多种解决方法,这里先分析常用的三种,推荐使用最后一种 第一种是最常用的,判断count(*)的值是否为零,如下declare v ...
- oracle中的exists 和not exists 用法 in与exists语句的效率问题
博文来源(oracle中的exists 和not exists 用法):http://chenshuai365-163-com.iteye.com/blog/1003247 博文来源( in与exi ...
- Oracle中not exists 与not in 的使用情况
1.在oracle11g以上版本,oracle已经做了优化,能够自动将in优化成exists方式,因此oracle11g以上版本,使用in和exists效果是一样的. 2.在oracle中,使用not ...
- ORACLE 中IN和EXISTS比较
ORACLE 中IN和EXISTS比较 EXISTS的执行流程 select * from t1 where exists ( select null from t2 where y = x ...
- oracle中的exists 和 in 用法详解
以前一直不知道exists和in的用法与效率,这次的项目中需要用到,所以自己研究了一下.下面是我举两个例子说明两者之间的效率问题. 前言概述: “exists”和“in”的效率问题,涉及到效率问题也就 ...
- oracle 中的exists 和 in 效率问题
oracle中的 exists 和 in 的效率问题 --------------------------------------------------------------- +++++++++ ...
- [转]Oracle中没有 if exists(...)
本文转自:http://blog.csdn.net/hollboy/article/details/7550171 对于Oracle中没有 if exists(...) 的语法,目前有许多种解决方法, ...
- Oracle中没有 if exists(...)的解决方法
http://blog.csdn.net/hollboy/article/details/7550171对于Oracle中没有 if exists(...) 的语法,目前有许多种解决方法,这里先分析常 ...
- Oracle 中 not exists (select 'X' ...) 的含义
select a.col1,a.col2 from temp1 a where not exists (select 'X' from temp2 b where b.col2 = a.col1);s ...
随机推荐
- 爬虫、请求库requests
阅读目录 一 介绍 二 基于GET请求 三 基于POST请求 四 响应Response 五 高级用法 一 介绍 #介绍:使用requests可以模拟浏览器的请求,比起之前用到的urllib,req ...
- msfvenom向apk注入payload
首先安装apt-get install apkinjector 这个东西,msfvenom重新组装apk的时候会自动调用 msfvenom -x /路径/apk android/meterpreter ...
- HUST 1555 A Math Homework
1555 - A Math Homework 时间限制:1秒 内存限制:128兆 338 次提交 131 次通过 题目描述 QKL is a poor and busy guy, and he ...
- bzoj:4105: [Thu Summer Camp 2015]平方运算
Description Input 第一行有三个整数N,M,p,分别代表序列的长度.平方操作与询问操作的总次数以及在平方操作中所要模的数. 接下来一行N个数代表一开始的序列{X1,X2,... ...
- 1492: [NOI2007]货币兑换Cash
Description 小Y最近在一家金券交易所工作.该金券交易所只发行交易两种金券:A纪念券(以下简称A券)和 B纪念券(以下 简称B券).每个持有金券的顾客都有一个自己的帐户.金券的数目可以是一个 ...
- Codeforces Round #412 (rated, Div. 2, base on VK Cup 2017 Round 3)(A.B.C,3道暴力题,C可二分求解)
A. Is it rated? time limit per test:2 seconds memory limit per test:256 megabytes input:standard inp ...
- POJ 2531 暴力深搜
Network Saboteur Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 13494 Accepted: 6543 ...
- Codeforces Round #280 (Div. 2)_C. Vanya and Exams
C. Vanya and Exams time limit per test 1 second memory limit per test 256 megabytes input standard i ...
- HDU--2017
字符串统计 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Subm ...
- 重新学习一次javascript;
每次有项目的时候,总觉得自己什么都不会做,然后做的时候又很简单,一会就做完了,啪啪打脸: 每次别人问的时候,我知道怎么做,但是不知道具体原理,觉得瞬间low了: 想要好好的吧基础掌握一下: 这几天空闲 ...