1.普通索引:Mysql中最基本的索引,没有唯一性之类的限制。
创建方式: (1) create index <索引名> on 表名(列名);
(2) alter table 表名 add index [索引名](列的列表);
(3) create table 表名([..........], index [索引名](列的列表));
2.唯一性索引:与Mysql的普通索引基本相同,但是唯一的区别为:索引列的所有值只能出现一次,即值唯一。
创建方式: (1) create unique index <索引名> on 表名(列名);
(2) alter table 表名 add unique [索引名] (列名);
(3) create table 表名( [......], unique [索引名] (列名));
3.主键:主键是一种唯一性索引,但必须指定为 primary key(列名),每个表只能有一个主键。
创建方式: (1) create table 表名( [.......], primary key(列名));
(2) alter table 表名 add primary key(列名);
4.全文索引:MySQL从3.23.23版开始支持全文索引和全文检索。在Mysql中,全文索引的索引类型为 fulltext,全文索引可以在 Varchar 和 Text 类型的列上创建。
创建方式: (1) create fulltext index <索引名> on 表名(列名);
(2) alter table 表名 add fulltext [索引名] (列名);
(3) create table 表名( [......], fulltext [索引名] (列名));
待续....................
参考文献:http://www.yesky.com/464/1892464.shtml
MySQL documentation