美文网首页
MyBatis知识梳理

MyBatis知识梳理

作者: 郝小发的生活 | 来源:发表于2018-11-24 14:09 被阅读0次

select * from aaa a where exists (select * from bbb b where b.id=a.id)

相当于 

select * from aaa where id in (select id from bbb)

加 NOT 相当于 

select * from aaa where id not in (select id from bbb)

只是exists的执行效率比in高的多,in要去匹配全表,exists只匹配索引

相关文章

网友评论

      本文标题:MyBatis知识梳理

      本文链接:https://www.haomeiwen.com/subject/iwjffqtx.html