Examples--Create Index Statement
The following are create index statement examples:
1. Create an index for the columns, ename and age, on the employee table. The index is recreated when the table is modified.
create index ename on employee (ename, age)
with persistence;
2. Create an index called ename and locate it on the area referred to by the location_name, remote.
create index ename on employee (ename, age)
with location = (remote);
3. Create a B-tree index on the ename and eage columns, keyed on ename with leaf index pages filled 50 percent.
create index ename2 on employee (ename, eage)
with key = (ename),
structure = BTREE,
leaffill = 50;
4. Create a unique index, specifying that uniqueness is checked after any update statements are completed.
create unique index ename3 on employee (ename, empno)
with key = (ename, empno),
unique_scope = STATEMENT;
5. Create a single, unique index on column c1 in table tl.
create unique index i1 on t1 (c1);
6. Create a unique index using the with clause to override the default index structure.
create unique index i1 on t1(c1) with structure=HASH;