C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Indexes in SQL


Posted Date: 29 Sep 2008    Resource Type: Articles    Category: Databases

Posted By: Athira Appukuttan       Member Level: Diamond
Rating:     Points: 10



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)







Responses

Author: Roopesh Babu Valluru    14 Oct 2008Member 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 ....


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Indexes in SQL  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Difference between Unique key and Primary Key
Previous Resource: Understand Views
Return to Discussion Resource Index
Post New Resource
Category: Databases


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

it help desk

Contact Us    Privacy Policy    Terms Of Use