What is the difference between a clustered and a non-clustered index?
Short answer: Clustered Index: The data in the table is physically sorted based on the clustered index.
Explain a bit more
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.
Say this in the interview
- Define — one clear sentence (the short answer above).
- Example — relate it to a project like ShopNest or your real work.
- Trade-off — when you would not use it.
Share this Q&A
Share preview image: https://www.toolliyo.com/images/toolliyo-logo.png