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

mysql添加删除索引

时间:2020-06-30 12:54:19      阅读:76      评论:0      收藏:0      [点我收藏+]

标签:uniq   creat   添加   time   comment   _id   null   tree   auto   

mysql> show create table table_test;
+---------------------------------------+---------------------------+
| Table | Create Table |
+---------------------------------------+---------------------------+
| table_test | CREATE TABLE `table_test` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT ‘涓婚敭‘,
`activity_id` varchar(20) NOT NULL COMMENT ‘娲诲姩ID‘,
`store_code` varchar(100) NOT NULL COMMENT ‘娲诲姩鍚嶇О‘,
`generation_date` date DEFAULT NULL COMMENT ‘鐢熸垚鏃ユ湡,鏍煎紡锛歽yyy-MM-dd‘,
`ordercon_num` bigint(20) DEFAULT ‘0‘ COMMENT ‘璁㈠崟杞寲浜烘暟‘,
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT ‘鍒涘缓鏃堕棿‘,
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT ‘鏇存柊鏃堕棿‘,
`delete_flag` varchar(1) DEFAULT ‘1‘ COMMENT ‘鐘舵€?1-鍚敤锛?-鍒犻櫎‘,
PRIMARY KEY (`id`),
UNIQUE KEY `uk_activityid_date` (`activity_id`,`generation_date`) USING BTREE,
KEY `idx_storecode` (`store_code`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT=‘搴楅摵缁村害澶╄〃‘ |
+---------------------------------------+---------------------------
乱码正好算加密了~

删除联合主键索引:

ALTER TABLE table_test DROP INDEX `uk_activityid_date`;

添加索引:

ALTER TABLE table_test ADD INDEX `idx_activityid` (`activity_id`) USING BTREE;

 

mysql添加删除索引

标签:uniq   creat   添加   time   comment   _id   null   tree   auto   

原文地址:https://www.cnblogs.com/yoyotl/p/13212999.html

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