当前位置:Gxlcms > 数据库问题 > SQL 语句 In和Exists区别

SQL 语句 In和Exists区别

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

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区别

标签:

人气教程排行