国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 數(shù)據(jù)庫(kù) > 文庫(kù) > 正文

where 子句的執(zhí)行順序

2020-10-29 21:54:39
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友
看代碼:
復(fù)制代碼 代碼如下:

set statistics io on
set statistics time on
go
set statistics profile on
go

use pubs
select * from authors
where (au_fname like 'S%' or au_fname like 'a%')
and (state like 'CA' or state like 'UT')
and (cast(zip as int) > 90000)

select * from authors
where (au_fname like 'S%' or au_fname like 'a%')
and (cast(zip as int) > 90000)
and (state like 'CA' or state like 'UT')

select * from authors
where (cast(zip as int) > 90000)
and (au_fname like 'S%' or au_fname like 'a%')
and (state like 'CA' or state like 'UT')

目的:想驗(yàn)證where語(yǔ)句的各個(gè)條件的查詢順序
環(huán)境:SQLServer 2005Express版本
步驟:顯示查詢計(jì)劃
結(jié)果:無(wú)一例外,都被統(tǒng)一成了這樣的代碼
復(fù)制代碼 代碼如下:

|--Clustered Index Scan(OBJECT:([pubs].[dbo].[authors].[UPKCL_auidind]), WHERE:(CONVERT(int,[pubs].[dbo].[authors].[zip],0)>(90000) AND ([pubs].[dbo].[authors].[au_fname] like 'S%' OR [pubs].[dbo].[authors].[au_fname] like 'a%') AND ([pubs].[dbo].[authors].[state] like 'CA' OR [pubs].[dbo].[authors].[state] like 'UT')))

結(jié)論:貌似在2005之前的版本中,where子句的順序是從前往后的。但是又貌似在2005的版本中進(jìn)行了優(yōu)化,所有的順序都被統(tǒng)一成了以過(guò)濾能力進(jìn)行排序的語(yǔ)句。
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 仙居县| 河间市| 康平县| 黄浦区| 鲜城| 玉树县| 二连浩特市| 桂东县| 平和县| 仙居县| 泽州县| 乌鲁木齐县| 高陵县| 济宁市| 桂林市| 金川县| 锡林浩特市| 扬州市| 敖汉旗| 惠水县| 志丹县| 乐亭县| 洛浦县| 额尔古纳市| 当阳市| 奉贤区| 新宁县| 博罗县| 五河县| 平江县| 江永县| 军事| 汉川市| 巧家县| 湘阴县| 大方县| 阳山县| 玉环县| 宁强县| 信宜市| 长泰县|