How can a composite index be created in Oracle?

To create a composite index in Oracle, you can use the CREATE INDEX statement and add the column names after the index name.

The grammar is as follows:

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

In this case, index_name is the name of the index, table_name is the name of the table where the index will be created, and column1, column2, … are the names of the columns to be included in the index.

If you want to create a composite index in a table called employees that includes columns named first_name and last_name, you can use the following statement:

CREATE INDEX idx_name 
ON employees (first_name, last_name);

This will create a composite index called idx_name in the employees table, which will include the columns first_name and last_name.

bannerAds