O'Reilly logo

Visual Basic® .NET Database Programming by Rod Stephens

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CREATE INDEX

The CREATE INDEX statement adds an index to a table or view. When you create an index, the database builds data structures to make searching and sorting on the fields in the index faster. The data structures take a little more space in the database and they make adding and updating records a little slower, so you shouldn’t go overboard with indexes. Use indexes to speed queries that you execute often but don’t index every field.

The optional UNIQUE keyword makes the index require unique values. If a set of fields forms a unique index, you cannot add two records to the table with the same values for those fields. The basic syntax for the statement is

CREATE [UNIQUE] INDEX index_name ON table_name (column, column2, ...) 

For example, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required