码迷,mamicode.com
首页 > 数据库 > 详细

SQL 语句 In和Exists区别

时间:2015-07-06 14:08:30      阅读:135      评论:0      收藏:0      [点我收藏+]

标签:

select * from tb1 where rowid in (select rowid from tb2 where ...)

select * from tb1 where exists (select * from tb2 where tb2.rowid=tb1.rowid)

当td2数据量比较大的时候,用exists查询效率更高。当tb1和tb2数据量差不多的时候,查询效率差不多。

 

SQL 语句 In和Exists区别

标签:

原文地址:http://www.cnblogs.com/chenxiulou/p/4624124.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!