数据库 - MySQL中删除带有索引的字段后,索引会自动删除么?
PHPz
PHPz 2017-04-17 11:25:54
0
1
976

MySQL表中加一个字段并添加了Index索引,现在把字段删除后对该字段的索引是否还存在?若存在,后期要怎么删除该索引?

附上执行的sql语句:

ALTER TABLE `mytab` ADD COLUMN `is_export`  enum('yes','no') CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'no' COMMENT '是否已经导出' AFTER `start_time`;

CREATE INDEX `is_export` ON `mytab`(`is_export`) USING BTREE ;
PHPz
PHPz

学习是最好的投资!

reply all(1)
左手右手慢动作

http://dev.mysql.com/doc/refman/5.6/en/alter-table.html

If columns are dropped from a table, the columns are also removed from
any index of which they are a part. If all columns that make up an
index are dropped, the index is dropped as well.

So for your question, after the field is deleted, the index of the field does not exist anymore

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template