SQL 语句 In和Exists区别

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数据量差不多的时候,查询效率差不多。

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