Search This Blog

Friday, September 7, 2012

COMPOSITE INDEX


Composite index is also a part of indexes which is used to create index on multiple columns (It allows maximum 32 columns).
Columns in a composite index can appear in any order and need not be adjacent columns of the table.
It will not create any constraints like unique.
Syntax:-
SQL>create index  on  (, ….column n);
Example:-
SQL> create index na_comp_idx on EMP (hiredate, sal);
 
 
-- Index created.
For dropping index
Syntax:-
Drop index ;
Example:-
SQL>Drop index idx1;
 
-- Index dropped
If we want drop index we can drop only one at a time but not multiple.
If we try to drop multiple indexes. System will raise an error like “sql command not properly ended “shown below.
SQL>drop index na_comp_idx, NA_UNIQ_CONS;

No comments:

Post a Comment