Locked lesson.
About this lesson
We will talk about what indexing is and how to do it within MS SQL Server
Exercise files
Download this lesson’s related exercise files.
Indexing.docx59.1 KB Indexing - Solution.docx
59.5 KB
Quick reference
Indexing
Indexing allows SQL to search your database faster.
When to use
You should always use indexing.
Instructions
Indexing is like an index in a book. It allows us to search for things quicker. It mainly works in the background.
You can index any column, or all columns.
To create an index:
CREATE INDEX my_index
ON [dbo].[Current_Customers] ([Customer ID])
To remove an index:
DROP INDEX my_index
ON [dbo].[Current_Customers] ([Customer ID])
Hints & tips
- Indexing speeds up searching in your database.
- You can index any column, or all columns.
- You can create or remove an index.
Lesson notes are only available for subscribers.