From the course: SQL Server 2008 Essential Training

Unlock the full course today

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

Understanding and creating indexes

Understanding and creating indexes - SQL Server Tutorial

From the course: SQL Server 2008 Essential Training

Start my 1-month free trial

Understanding and creating indexes

Flip to the back of any thick technical book and you're going to find an index. If you need to look up some content that's buried somewhere in a thousand pages of text, you're going to turn to the back of the book, scan through the index to find what you're looking for, say deviation analysis, realize it's on page 322 and then turn directly to that section to read that content. Indexes give you a quick way to look something up. That's what they do in books and that's what they do in databases. When we're working with SQL Server 2008, we can create two kinds of index. The first is what's called a clustered index. A clustered index is applied to one of the columns in our table and it will order our table based on that index. In this case I'm looking at it as the CustomerID in ascending order. If for example I remove the clustered index from that column and applied it to the LastName column, it would require that the data itself be reorganized internally based on that clustered index. So…

Contents