In SQL, how do you explain the differences between clustered and non-clustered indexes? Can you name a time that you used each?
Digital Ocean uses indexes to improve query performances within their software and for this question, your interviewer is looking to hear that you have a basic understanding of both clustered and non-clustered indexes. Explain the differences between the two types of indexes and be sure you can either speak to relevant times that you've used each or when would be the appropriate application to use each.
"In the simplest of terms, a clustered index order records in a table the way that they are physically stored. There can only be one clustered index per table. Non-clustered indexes do not store data to match the physical order that it is stored. Rather, it can hold up to 249 indexes per table. Both types come with their own benefits over the other. In my experience, clustered indexes are suited best for programs that use primary key as an identity integer column. On the other hand, non-clustered make the most sense for programs that need JOIN and WHERE clauses within them."
