1: Index
An index is a special kind of file that contains reference pointers to all the records in the data table. It is a structure that sorts the values of one or more columns in a database table.
Simple to understand:
A database index is like a directory in front of a book that accelerates the query speed of a database, which is the directory in which values in some fields are created to improve the search efficiency of the table.
By indexing we can be more efficient when querying a database.
The index is divided into:
1, normal index 2, unique index 3, primary key index (most ID) 4, full-text index.
An index can also be divided into a single-column indexed index content that is only one of the columns in the database.
A composite index is an index of many columns.
Index creation: Lter table name add index index name (column name).
Example: ALTER TABLE employee ADD index Idx_birthday (birthday).
To delete an index:
ALTER TABLE name DROP INDEX index name
Creating a composite Index: example:
Create INDEX idx_name_phoneno_ads on Student_9 (name,phoneno,address)
ALTER TABLE Student_9 Add index idx_name_phoneno_ads (name,phoneno,address)
MySQL Advanced Learning-index