ODBC Server Reference Manual

CORE SQL Language
HP NonStop ODBC Server Reference Manual429151-002
3-37
CREATE INDEX
CREATE INDEX
Use CREATE INDEX to create indexes.
The CREATE INDEX statement has the following syntax:
UNIQUE
specifies that two or more rows of the table cannot have the same values for the
indexed columns.
NonStop SQL/MP does not allow unique indexes on nullable columns.
index-name
specifies the index to create. The named index must not already exist.
base-table-name
is the table in which the indexed column or columns are located. It must be an
existing table. The table-name can be qualified with the database and owner.
column-identifier
specifies the column or columns to which the index applies.
ODBC does not limit the number of columns you can specify. In NonStop SQL/MP,
however, the number of columns that can be indexed depends on the length of the
index key. For more information, see the NonStop SQL/MP Reference Manual.
[ ASC | DESC ]
specifies whether the order of the referenced column is ascending or descending.
ASC is the default.
Examples
The following statements create indexes on the EMPLOYEE table:
create unique index xempnum on employee (empnum)
create index xempname on employee (last_name, first_name)
CREATE [UNIQUE] INDEX index-name
ON base-table-name
( column-identifier [ ASC | DESC ]
[, column-identifier [ ASC | DESC ] ... )