两个SQL语句


在查询分析器里,查看Query 的 Display Estimated Exceution Plan Ctrl+L ,Show exection Plan Ctrl+K,

set SHOWPLAN_TEXT on
go
select * from stock_detail inner join barcode_master on stock_detail.barcode=barcode_master.barcode
where style1 in(1,3)

select * from stock_detail inner join barcode_master on stock_detail.barcode=barcode_master.barcode
where
exists (select style_code from style1 where style_code in(1,3) and barcode_master.style1=style1.style_code )
go

set FORCEPLAN on
select * from stock_detail inner join barcode_master on stock_detail.barcode=barcode_master.barcode
where style1 in(1,3)

select * from stock_detail inner join barcode_master on stock_detail.barcode=barcode_master.barcode
where
exists (select style_code from style1 where style_code in(1,3) and barcode_master.style1=style1.style_code )
set FORCEPLAN off

antony
:antony1029@163.com
:http://antony1029.cnblogs.com
原文地址:https://www.cnblogs.com/antony1029/p/567021.html