From the course: Database Foundations: Data Structures

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Add indexes to a table

Add indexes to a table

From the course: Database Foundations: Data Structures

Start my 1-month free trial

Add indexes to a table

- [Instructor] Adding indexes to your data tables only requires a single command. First, you need to identify a situation, where an index would be helpful. Let's take a look at the customer's table on the Two Trees database that's in the SQL server instance. The primary key for this table is on the customer ID column. So, we know there's already an index that's used for searching for rows based off of these values. Let's suppose that another way that we often find information about the Two Trees Olive Oil Company's customers is by searching for it based off of the state values. Now, to be clear, searches don't always have to be one off queries that are written with a select statement, and a where clause. Any automated reporting system that pulls data and organizes it into groups based off of the state values or a dashboard that displays aggregate information across the state would also benefit from an index on this column.…

Contents