What is key and non-key column wrt to indexes

  • 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.

  • 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.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply