In which situation the sql server use the index?


for example customer want information employee table.the table containing 2000 employees details,in 1 more 1750 employees draw 10k 20k salary , remaining employees draw more 20k salary. client ask want employees details draw between 10k 20k salary.so,in situation sql server use index data employee table fast? other wise in situation sql server use index?

i sure table has employee no. columns nad has primary key .if yes , should create non-clustered index in salary column , including select columns in include section should suffice ..

if dont have primary key on column make clustered index on employee no. column used in of queries .primary key creates clustered index .

if query : select * employee salary between 10000 , 20000 create non-clustered index on salary .

if query : select name , age employee salary between 10000 , 20000 create non-clustered index on salary , include name , age columns in index (this fro 2005 , above).

 


abhay chaudhary ocp 9i, mcts/mcitp (sql server 2005, 2008, 2005 bi) ms-abhay.blogspot.com/


SQL Server  >  SQL Server Database Engine



Comments

Popular posts from this blog

Conditional formatting a graph vertical axis in SSRS 2012 charts

Register with Power BI failed

SQL server replication error Cannot find the dbo or user defined function........