April 2002
Intermediate to advanced
416 pages
11h 50m
English
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, ...
Read now
Unlock full access