This section is all about Indexes in SQL Server. In this article, we will learn about indexes in SQL Server like creating an index, renaming an index, dropping an index, and more.
INDEXES are Special Data Structures associated with tables or views that will help to speed up the data fetching/ queries.
Indexes are similar to the index of a book/ Notebook, Whenever we want to search any topic, we refer to the index to find that page number to access quickly without going through all pages of the book. Indexes in SQL Server work in the same manner, an index can be created with both tables and views.
SQL Server provides two types of indexes:
- Clustered index
- Non-clustered index
Clustered index:
Clustered index is a default phenomenon and there can be only one clustered index in a table because rows can be only sorted in one order
How to create clustered index?
CREATE CLUSTERED INDEX
index_Name
on Schema_Name.table_name (Columns)
Non-clustered index:
How to create non clustered index?
CREATE [NONCLUSTERED] INDEX index_Name
on Schema_Name.table_name (Columns)
Some Notable Syntax:
- INDEXES
- Types of Indexes
- Renaming Indexes
- Drop Indexes
0 Comments