When SQL Server Uses Indexes:
Sql sever uses indexes of a table provided the select or update or delete statement contained “where” condition
in them and more over the where condition column must be a indexed column.
If the select statement contain an “order by” clause also indexes will use.
Note:- When sql sever is searching for information under the database first it verifies the best execution plan
for retriring the data and uses that plan which can be either a full page scan or index scan also.
1 2 3 4 5 6 7 8 |
Ex: Select * from Employee Select * from Employee Where Empno=1003 Select * from Employee Where Ename='scott' Select * from Employee Where sal>3000 Select * from Employee Where Job='manager' Select * from Employee Where soundex(ename)=Soundex('smyth') Select * from Employee order by Sal Desc |