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

MySQL.索引

时间:2015-06-01 22:21:43      阅读:162      评论:0      收藏:0      [点我收藏+]

标签:

-- 单字段索引
CREATE INDEX LAST_NAME_INDEX 
    -> ON EMPLOYEE_TBL (LAST_NAME);
Query OK, 0 rows affected (0.06 sec)


-- 唯一索引
CREATE UNIQUE INDEX LAST_NAME_UNIQUE_INDEX
    -> ON EMPLOYEE_TBL (LAST_NAME);
ERROR 1062 (23000): Duplicate entry GLASS for key LAST_NAME_UNIQUE_INDEX


-- 组合索引
CREATE INDEX ORDER_INDEX
    -> ON ORDERS_TBL (CUST_ID, PROD_ID);
Query OK, 0 rows affected (0.02 sec)


-- 修改索引
ALTER INDEX INDEX_NAME


-- 删除索引
DROP INDEX LAST_NAME_INDEX
    -> ON EMPLOYEE_TBL;
Query OK, 0 rows affected (0.03 sec)
Records: 0  Duplicates: 0  Warnings: 0

DROP INDEX ORDER_INDEX
    -> ON ORDERS_TBL;
Query OK, 0 rows affected (0.04 sec)
Records: 0  Duplicates: 0  Warnings: 0

 

MySQL.索引

标签:

原文地址:http://www.cnblogs.com/fatoland/p/4544823.html

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