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 ...
随机推荐
- SpringBoot集成security
本文就SpringBoot集成Security的使用步骤做出解释说明.
- 2017 ICPC区域赛(西安站)--- J题 LOL(DP)
题目链接 problem description 5 friends play LOL together . Every one should BAN one character and PICK o ...
- js面向对象学习笔记(四):对象的混合写法
//对象的混合写法//1.构造函数function 构造函数() { this.属性}构造函数.原型.方法 = function () {};//调用var 对象1 = new 构造函数();对象1. ...
- 我们编写 React 组件的最佳实践
刚接触 React 的时候,在一个又一个的教程上面看到很多种编写组件的方法,尽管那时候 React 框架已经相当成熟,但是并没有一个固定的规则去规范我们去写代码. 在过去的一年里,我们在不断的完善我们 ...
- Codeforces Round #416(Div. 2)-811A.。。。 811B.。。。 811C.dp。。。不会
CodeForces - 811A A. Vladik and Courtesy time limit per test 2 seconds memory limit per test 256 meg ...
- 面试-java算法题
1.编写一个程序,输入n,求n!(用递归的方式实现). public static long fac(int n){ if(n<=0) return 0; else if(n==1) retur ...
- keepalived VS zookeeper
转载请标明出处http://www.cnblogs.com/haozhengfei/p/e3db73cb83afb213a3bff43a850d56c4.html keepalived VS zook ...
- Yourphp是一款完全开源免费的.核心采用了Thinkphp框架
Yourphp企业网站管理系统,是一款完全开源免费的PHP+MYSQL系统.核心采用了Thinkphp框架,同时也作为开源软件发布.集众多开源项目于一身的特点,使本系统从安全,效率,易用及可扩展性上更 ...
- C语言第二次实验报告
1.实验题目 题1:11-7 找鞍点(20 分) 一个矩阵元素的"鞍点"是指该位置上的元素值在该行上最大.在该列上最小. 本题要求编写程序,求一个给定的n阶方阵的鞍点 题2: ...
- centos7安装python3.6
安装python3.6可能使用的依赖 # yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sql ...