1. Index classification
1.1 Classification of indexes in InnoDB
The structure of the B+ tree between the clustered index and the secondary index
explains the execution process of the SQL statement index.
The efficiency of the clustered index query based on the id is higher than that of the secondary index, so the execution efficiency of the first SQL is higher than that of the second SQL.
2. Index syntax
If an index is only associated with one field, this type of index is called a single-column index, and if an index is associated with multiple fields, this type of index is called a joint index or a composite index.
2.1 Create an index
The index structure is not specified when creating the index, but the table defaults to the table of the InnoDB engine, so the index structure defaults to a B+ tree.
Requirement 1, create an index for the name field, the operation is as follows
Requirement 2, create a unique index for the phone field, the operation is as follows
Requirement 3, create a joint index for profession, age, status.
Requirement 4, create an index for the email field