>
Part | Description |
index | The name of the index to be created. |
table | The name of the existing table the index will be created on. |
field | The name of the field or fields to be indexed. To create a single-field index, list the field name in parentheses following the table name. To create a multiple-field index, list the name of each field to be included in the index. To create descending indexes, use the DESC reserved word; otherwise, indexes are assumed to be ascending. |
CREATE INDEX NewIndex ON Employees (HomePhone, Extension);This example creates an index on the Employees table using the Social Security Number field. No two records can have the same data in the SSN field, and no Null values are allowed.
CREATE UNIQUE INDEX CustID ON Customers (CustomerID) WITH DISALLOW NULL;This example creates an index on a hypothetical ODBC linked table. The table's remote database is unaware of and unaffected by the new index.
CREATE UNIQUE INDEX OrderID ON OrderDetails (OrderID);