CREATE INDEX

SQL CREATE INDEX Keyword

The CREATE INDEX command is used to create indexes on columns in a table. Indexes make it faster to search for data but do not change the table’s visible structure. Indexes allow duplicate values unless defined as UNIQUE.

Tutorials dojo strip

SQL CREATE INDEX Syntax

SQL

SQL CREATE INDEX Example

This creates an index named idx_lastname on the last_name column of the Patients table. It helps speed up queries that search for patients by last name.

SQL

SQL CREATE INDEX on Multiple Columns Example

To create an index on two or more columns include the column names separated by commas.

This creates a combined index on the last_name and gender columns.

SQL

SQL CREATE INDEX Labs

Tutorials dojo strip