mysql新增刪除索引 mysql新增刪除索引

2021-10-18 08:22:49 字數 1111 閱讀 1401

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新增 刪除索引

應用於表建立完畢之後再新增 alter table 表名 add 索引型別 unique,primary key,fulltext,index 索引名 欄位名 普通索引 alter table table name add index index name column list 唯一索引 alte...

mysql 取消索引設定 mysql新增刪除索引

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 ...

mysql敤 罰 mysql新增刪除索引

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 ...