IN SQL :
An Index is a database object used to retrieve the data fastly from the Tables.
An Index increases the performance of the database.
The basic syntax of CREATE INDEX is as follows:
CREATE INDEX index_name ON table_name;
Types:
- Single-Column Indexes: A single-column index is one that is created based on only one table column.
CREATE INDEX index_name ON table_name (column_name);
- Unique Indexes: Unique indexes are used not only for performance, but also for data integrity. A unique index does not allow any duplicate values to be inserted into the table.
CREATE UNIQUE INDEX index_name on table_name (column_name);
- Composite Indexes: A composite index is an index on two or more columns of a table
CREATE INDEX index_name on table_name (column1, column2);
- Implicit Indexes : Implicit indexes are indexes that are automatically created by the database server when an object is created. Indexes are automatically created for primary key constraints and unique constraints.