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, ...
Get Visual Basic® .NET Database Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.