SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


What is key and non-key column wrt to indexes


What is key and non-key column wrt to indexes

Author
Message
Shadab Shah
Shadab Shah
SSC Eights!
SSC Eights! (957 reputation)SSC Eights! (957 reputation)SSC Eights! (957 reputation)SSC Eights! (957 reputation)SSC Eights! (957 reputation)SSC Eights! (957 reputation)SSC Eights! (957 reputation)SSC Eights! (957 reputation)

Group: General Forum Members
Points: 957 Visits: 798
Hi,
Since this might be the most basic question hence i did not find its answer anywhere. Could anybody tell me what is mean by Key & Non-Key column with respect to indexes.
anthony.green
anthony.green
One Orange Chip
One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)One Orange Chip (25K reputation)

Group: General Forum Members
Points: 25284 Visits: 6519
A key column is the column(s) that the index is created on, the non-key column are included columns

CREATE NONCLUSTERED INDEX idx1 ON Table1 (Col1, Col2) INCLUDE (Col3, Col4)

In the above example, Col1 and Col2 are key columns, Col3 and Col4 are non-key columns

CREATE CLUSTERED INDEX cidx ON Table1 (Col1)

In the above example Col1 is the key column, and all other columns in the table are classed as non-key columns, as the clustered index is the table.



Want an answer fast? Try here
How to post data/code for the best help - Jeff Moden
When a question, really isn't a question - Jeff Smith
Need a string splitter, try this - Jeff Moden
How to post performance problems - Gail Shaw
CrossTabs-Part1 & Part2 - Jeff Moden
SQL Server Backup, Integrity Check, and Index and Statistics Maintenance - Ola Hallengren
Managing Transaction Logs - Gail Shaw
Troubleshooting SQL Server: A Guide for the Accidental DBA - Jonathan Kehayias and Ted Krueger


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search