Junior SQL

What is the difference between a clustered and a non-clustered index?

  • Clustered Index:
  • The data in the table is physically sorted based on the clustered index.
  • Each table can have only one clustered index (usually the primary key).
  • Fast for queries that involve range-based retrieval (e.g., BETWEEN or ORDER

BY).

  • Non-Clustered Index:
  • The data in the table is not physically sorted. The non-clustered index is

stored separately from the actual data.

  • A table can have multiple non-clustered indexes.
  • Faster for point lookups (single value queries) but less efficient for

range-based searches.

More from SQL Server Tutorial

All questions for this course