Third, index
3. Related operations of the index
We talked about the role and type of the index, and we talked about the index of the relevant operation!
1) Add index
We've got some introductions here, so here's a summary.
Add primary key Index
CREATE TABLE AAA (ID int unsigned primary key auto_increment, name varchar (+) NOT null Defaul "); ALTER TABLE name add Prima Ry key (column name);
Add a normal index
Create index index name on table (column name 1, column name 2);
Add a unique index
CREATE TABLE DDD (ID int primary key auto_increment, name varchar () unique); Create unique index index name on table name (list:);
To add a full-text index
CREATE TABLE articles ( ID INT UNSIGNED auto_increment not NULL PRIMARY KEY, title VARCHAR (+), body Text,
fulltext (title,body) ) Engine=myisam charset UTF8; ALTER TABLE Articles ADD fulltext (title,body);
2) Query Index
Show index from Emp\g
3) Delete Index
Drop index name on table name;
4) Modify the index
Delete First, then create
At the end of this lecture, we will talk about the price of the index.
Database tuning Tutorial (vi) related operations for indexes