Scripts for Indexes - Part 4

on 7:21 AM

CREATE INDEX : Creates an index on a table where Duplicate values are allowed.

CREATE INDEX Syntax : CREATE INDEX index_name ON table_name (column1, column2, ...);

SQL> CREATE INDEX emp_ename ON emp(ename);
 
         Index created.

CREATE UNIQUE INDEX : Creates a unique index on a table where Duplicate values are not allowed:

CREATE UNIQUE INDEX Syntax :CREATE UNIQUE INDEX index_name ON table_name (column1, column2, ...);

SQL> CREATE UNIQUE INDEX dept_unique_index ON dept                  (dname);

                Index created.

DROP INDEX : To Drop the index.

DROP INDEX Syntax : DROP INDEX index_name;

SQL> DROP INDEX emp_ename; 

        Index dropped.

0 comments:

Post a Comment