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只匹配索引
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
网友评论