当前位置:Gxlcms > 数据库问题 > oracle中的exists 和not exists 用法详解

oracle中的exists 和not exists 用法详解

时间:2021-07-01 10:21:17 帮助过:2人阅读

http://blog.sina.com.cn/s/blog_601d1ce30100cyrb.html

有两个简单例子,以说明 “exists”和“in”的效率问题

1) select * from T1 where exists(select 1 from T2 where T1.a=T2.a) ;

    T1数据量小而T2数据量非常大时,T1<<T2 时,1) 的查询效率高。

2) select * from T1 where T1.a in (select T2.a from T2) ;

     T1数据量非常大而T2数据量小时,T1>>T2 时,2) 的查询效率高。

oracle中的exists 和not exists 用法详解

标签:

人气教程排行