(1) 创建非聚集、非唯一值索引
IX_Startdate(startdate)
IX_workorder_ProductID(productID)
(2)创建索引,IX_StartDate(Startdate,Enddate),请问有什么现象,为什么?
名为IX_StartDate索引已存在,我们需要另外指定索引名才可创建
(3)创建索引,IX_Workorder_ProductID2(ProductID),请问有会么现象,为什么?
名为IX_Workorder_ProductID2索引不存在,可以创建
(4) select * from Production.WorkOrder where ProductID =732的执行计划,写明该查询语句使用了哪个索引?
该查询语句使用了索引IX_workorder_ProductID(productID)
(5)select * from Production.WorkOrder where ProductID >732的执行计划,写明该查询语句使用用了哪个索引?
该查询语句没有使用索引,因为语句中第一个条件使用了>,就不适用索引
(6)使用索引提示,强制select * from Production.WorkOrder with(index (IX_Workorder_ProductID2)) where ProductID =732,使用索引IX_Workorder_ProductID2,执行计划是什么样的?
该语句使用索引IX_Workorder_ProductID2(ProductID)
(7)禁止索引IX_WorkOrder_ProductID,查看select * from Production.WorkOrder where ProductID =732的执行计划,写明该查询语句使用哪个索引?
该语句使用的是默认存在的索引IX_WorkOrder_ProductID(ProductID)
(8)禁止索引IX_WorkOrder_ProductID,并且使用索引提示,强制查询select * from Production.WorkOrder where ProductID =732,使用索引IX_WorkOrder_ProductID,请问有什么现象?
该语句查询时将会出错








































