---
title: "Indexes in SQL"  
description: "In this blog, I’m explaining about Indexes in SQL  Indexes  are created on columns in tables or views. The index provides a fast way to look up data b"  
author: "priyanka kushwaha"  
published: 2015-01-29  
updated: 2015-01-29  
canonical: https://www.mindstick.com/blog/742/indexes-in-sql  
category: "mssql server"  
tags: ["sql server", "index"]  
reading_time: 1 minute  

---

# Indexes in SQL

In this blog, I’m explaining about [Indexes](https://www.mindstick.com/articles/12525/indexes-in-sql-server) in SQL\

Indexes are created on columns in [tables](https://www.mindstick.com/articles/336597/introduction-of-html-tables-for-web-development) or views. The index provides a fast way to look up data base on the [values](https://www.mindstick.com/forum/327/sum-textbox-values) within those columns.

##### Types of indexes

1. Clustered Indexes
2. Non Clustered Indexes

##### Cluster Indexes

Only 1 [clustered index](https://www.mindstick.com/blog/337/clustered-non-clustered-indexing-in-sql-server) allowed per table physically rearranges the [data in the table](https://www.mindstick.com/forum/34030/how-to-display-data-in-the-table-using-angular-js) to [confirm](https://answers.mindstick.com/qa/115761/facebook-account-locked-with-confirm-your-identity-loop) to the index [constraints](https://www.mindstick.com/forum/34816/what-is-mapping-constraints-in-database-management-system) for use on columns that are frequently searched for ranges of data for use on columns with low selectivity.

##### Example:

```
Create TABLE [dbo].[EmployeeDetail] ADD  CONSTRAINT [PK_EmployeeDetail] PRIMARY KEY CLUSTERED (            [EmployeeID] ASC)
```

##### Non Clustered Indexes

A non clustered Index is [useful](https://www.mindstick.com/articles/12694/how-dolomite-mineral-is-useful-in-human-life) for columns that have some repeated values. A table can have more than one Non-clustered index. Non clustered [column](https://www.mindstick.com/forum/33860/how-to-calculate-column-summary-in-sql-server) always depends on the clustered column on the database.

##### Example:

```
CREATE UNIQUE NONCLUSTERED INDEX [IX_EmployeeDetail] ON [dbo].[EmployeeDetail] ( [FirstName] ASC, [LastName] ASC)
```

##### Example:

```
 select * from EmployeeDetail with(index(IX_EmployeeDetail_1))
```

---

Original Source: https://www.mindstick.com/blog/742/indexes-in-sql

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
