MySql添加索引的五种方法

来源:互联网 发布:如何申请域名注册机关 编辑:程序博客网 时间:2024/04/30 23:38

1.添加primary key(主键索引)

alter   table  表名称   add  primary   key(列名);

2.添加unique(唯一索引)

alter  table  表名称  add  unique(列名);

3.添加index(普通索引)

alter  table  表名称  add  index  索引名(index_name)  (列名);

4.添加fulltext(全文索引)

alter  table  表名称  add  fulltext  (列名);

5.添加多列索引

alter  table  表名称  add  index  索引名(index_name)  (列名1,列名2.......);





0 0