SQL INDEX Keyword
The INDEX keyword is used to create indexes on one or more columns of a table to improve the performance of data retrieval. Indexes help speed up queries, especially on large datasets.
SQL INDEX Syntax
SQL
x
1
CREATE INDEX index_name
2
ON table_name (column1, column2, ...);
SQL
1
1
DROP INDEX index_name;
SQL INDEX Create an Index on a Column Example
SQL
1
1
CREATE INDEX idx_last_name
2
ON Patients (last_name);

SQL INDEX Create an Index on Multiple Columns
SQL
1
1
CREATE INDEX idx_name_gender
2
ON Patients (first_name, gender);

SQL INDEX Drop an Index Example
SQL
1
1
DROP INDEX idx_last_name;
