Indexes in SQL server are similar to the indexes in Books. They help SQL server retrieve the data quickly.
There are clustered and nonmclustered indexes.
A clustered indexes is a special type of index that records the way in which records in the table are physically stored.Therefore , table can have only one clustered index.The leaf nodes of a clustered index contain the data pages.
A nonClustered index is a special type of index in which the logical order of the index does not match the physical stored order of the rows on disk.The leaf node of a non clustered index dows not consist of the data pages .Instead the leaf nodes contain index rows.
The syntax for creating indexes
CREATE INDEX idxModel ON Product (Model)
Let's assume that we have the following table,
TABLE Customer (First_Name char(50), Last_Name char(50), Address char(50), City char(50), Country char(25), Birth_Date date)
and we want to create an index on the column Last_Name, we would type in,
CREATE INDEX IDX_CUSTOMER_LAST_NAME on CUSTOMER (Last_Name) [/COED] If we want to create an index on both City and Country, we would type in,
CREATE INDEX IDX_CUSTOMER_LOCATION on CUSTOMER (City, Country)
|
| Author: Roopesh Babu Valluru 14 Oct 2008 | Member Level: Gold Points : 1 |
i think it would be more better if u specify both clustered and non clustered indexesa nd bit of xplanation abt ur the syntax...
Thx for this ....
|