sql join 和不用join 哪个效率高?
语句1:select*fromtable1,table2wheretable1.id=table2.idandtable1.name<>'aaa'andtable2.va...
语句1:
select * from table1, table2 where table1.id=table2.id and table1.name <>'aaa' and table2.value > 50000 ;
语句2:
select * from table1 join table2 on table1.id=table2.id where table1.name <>'aaa' and table2.value > 50000; 展开
select * from table1, table2 where table1.id=table2.id and table1.name <>'aaa' and table2.value > 50000 ;
语句2:
select * from table1 join table2 on table1.id=table2.id where table1.name <>'aaa' and table2.value > 50000; 展开
4个回答
展开全部
结果没有区别
set statistics io on
set statistics time on
select * from table1, table2 where table1.id=table2.id and table1.name <>'aaa' and table2.value > 50000
set statistics io off
set statistics time off
set statistics io on
set statistics time on
select * from table1 join table2 on table1.id=table2.id where table1.name <>'aaa' and table2.value > 50000
set statistics io off
set statistics time off
执行一下看看结果就知道了!~
看看IO扫描和CPU时间就知道了!~
相对来说第二个效率高一些
set statistics io on
set statistics time on
select * from table1, table2 where table1.id=table2.id and table1.name <>'aaa' and table2.value > 50000
set statistics io off
set statistics time off
set statistics io on
set statistics time on
select * from table1 join table2 on table1.id=table2.id where table1.name <>'aaa' and table2.value > 50000
set statistics io off
set statistics time off
执行一下看看结果就知道了!~
看看IO扫描和CPU时间就知道了!~
相对来说第二个效率高一些
展开全部
语句2有错误吧。。
追问
哦 我随意写了下。。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
这个没什么区别吧? 一个是链接,一个不是而已
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |