[b]
[color=darkblue][size=xx-large][align=center]oracle中关于一些sql的问题[/align][/size][/color]
[/b]
[size=large]select t1.* from Tplatforminfo t1 where t1.id [color=red]not in[/color](select t2.platformid from Ttrsplatformtag t2);
select t1.* from Tplatforminfo t1 where [color=red]not exists[/color](select t2.platformid from Ttrsplatformtag t2 where t2.platformid=t1.id); [/size]
[size=x-large]not in 与 not exists的区别:
当t1表数量大;t2表的数量少时;not exists效率高
当t1表数量少;t2表的数量多时;not in效率高[/size]
[color=darkblue][size=xx-large][align=center]oracle中关于一些sql的问题[/align][/size][/color]
[/b]
[size=large]select t1.* from Tplatforminfo t1 where t1.id [color=red]not in[/color](select t2.platformid from Ttrsplatformtag t2);
select t1.* from Tplatforminfo t1 where [color=red]not exists[/color](select t2.platformid from Ttrsplatformtag t2 where t2.platformid=t1.id); [/size]
[size=x-large]not in 与 not exists的区别:
当t1表数量大;t2表的数量少时;not exists效率高
当t1表数量少;t2表的数量多时;not in效率高[/size]
本文探讨了 Oracle SQL 中 not in 与 not exists 的使用区别及性能对比。指出当主表数据量大而子表数据量小时,not exists 的查询效率更高;反之,当主表数据量小而子表数据量大时,则 not in 的查询效率更优。
5704

被折叠的 条评论
为什么被折叠?



