Indexes in DB are very similar to indexes in the books. It helps to search the data very quickly without scanning whole data in a table. Index can be defined on either single column or multiple columns of a table. index will arrange the data in specific manner . Index is an data structure that improves the operation of a table.
There are many classification of index in SQL, the following Indexes are most often used by everyone, which are as Clustered, Non-Clustered and Unique Index.
A clustered index sorts and stores the data rows of the table or view in order based on the clustered index key. The clustered index is implemented as a B-tree index structure that supports fast retrieval of the rows, based on their clustered index key values.
Every table can have only one clustered index.
A Nonclustered index can be defined on a table or view with a clustered index or on a heap. Each index row in the Nonclustered index contains the Nonclustered key value and a row locator. This locator points to the data row in the clustered index or heap having the key value. The rows in the index are stored in the order of the index key values, but the data rows are not guaranteed to be in any particular order unless a clustered index is created on the table.
Every table can have maximum of 249 Nonclustered index.
A unique index ensures that the index key contains no duplicate values and therefore every row in the table or view is in some way unique.
Both clustered and nonclustered indexes can be unique.