码迷,mamicode.com
首页 > 数据库 > 详细

mysql语句 索引操作

时间:2016-12-17 14:20:26      阅读:172      评论:0      收藏:0      [点我收藏+]

标签:创建索引   ble   操作   ack   column   type   art   help   sub   

 

 

创建索引:(help create index;)

CREATE INDEX indexName ON tableName(Coll,Coll....);

ALTER TABLE tableName ADD INDEX indexName(Coll,Coll);

 

eg:
联合索引:
create index Sage_Sdept on student(Sage,Sdpt(10))
create index d_a_p on student(dateline,ader(20),pos(20));

 

 

删除索引:

ALTER TABLE tableName DROP indexName;

DROP INDEX indexName ON tableName;

 

 

查看表的索引:

mysql> show index from proc;
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| proc | 0 | PRIMARY | 1 | db | A | NULL | NULL | NULL | | BTREE | | |
| proc | 0 | PRIMARY | 2 | name | A | NULL | NULL | NULL | | BTREE | | |
| proc | 0 | PRIMARY | 3 | type | A | 48 | NULL | NULL | | BTREE | | |
+-------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
3 rows in set (0.00 sec)

mysql语句 索引操作

标签:创建索引   ble   操作   ack   column   type   art   help   sub   

原文地址:http://www.cnblogs.com/fanxuanhui/p/6189482.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!