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

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

学习是最好的投资!

répondre à tous(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.

所以对你的问题, 字段删除后对该字段的索引 不存在

Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!