MySQL Tutorial
In MySQL, an index is used to improve the performance of database queries by allowing faster data retrieval. It creates a structure that helps locate data efficiently without scanning the entire table.
Creates an index on a table. Duplicate values are allowed:
CREATE INDEX index_name ON table_name (column1, column2);
The SQL statement below creates an index named "idx_student_name" on the "name" column in the "students" table:
If you want to create an index on a combination of columns, you can list the column names within the parentheses, separated by commas:
The DROP INDEX
statement is used to delete an index in a table.