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

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

学习是最好的投资!

Antworte allen(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.

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

Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!