The index will automatically generate a primary key ( generated with the primary key ) index when the table is created , so we can directly search the index
We can also create normal indexes
create index t_job_index on e_user(t_job);
Create index name Created table ( created column name ) // Format
So there can be multiple indexes .
delete normal index
drop index t_job_index on e_user;
Delete the table with the specified name on the table where the index is located // format
Create a unique index :
create unique index t_job_index on e_user(t_job);
Add the unique identifier and the other is the same as creating a normal index // Format
Drop unique index :
drop index t_job_index on e_user;
Delete the table with the specified name on the table where the index is located // format
Full text index :
FULLTEXT , can only be used for MyISAM tables ;
Create a full-text index :
Method 1 ( before building the table ):
create table e_users(
id int not null primary key auto_increment, //id cannot be empty and grows automatically
t_name varchar(20) not null, // Create a column to define the data type , size 20, cannot be empty
fulltext(t_name) // Create a full-text index defined in the specified column
)engine = MyISAM; // Specify the engine
Method 2 ( after building the table ):
① aleter table table name add fulltext index name ( column name );
② create fulltext index index name on table name ( column name );
composite index
Create a composite index :
alter table e_user add index name job index( t_name(10) , t_job(10) );
delete index :
drop index 索引名 on 表名;