是否有MySQL命令可以删除除单个表中的第一个索引之外的所有额外索引,从而仅保留主索引?MySQL命令删除表中的所有非主索引
我可以使用下面的MySQL命令删除第二个Post_Date索引,但是我在删除其余所有内容时遇到问题。
mysql_query("ALTER TABLE $TableName DROP INDEX Post_Date");
额外POST_DATE和Post_Date_x指标在脚本的开始创建的,所以我想在在脚本的末尾使用MySQL命令脚本的末尾删除它们。
记住_x在Post_Date_x和变化,可以去从1到10,或从1到100这样一个循环或IF可能需要声明。
MySQL命令将成为PHP脚本的一部分
谢谢你的时间。
Action Keyname Type Unique Packed Column Cardinality Collation Null Comment
Edit Drop PRIMARY BTREE Yes No id 830 A
Edit Drop Post_Date BTREE Yes No Post_Date 830 A
Edit Drop Post_Date_2 BTREE Yes No Post_Date 830 A
Edit Drop Post_Date_3 BTREE Yes No Post_Date 830 A
Edit Drop Post_Date_4 BTREE Yes No Post_Date 830 A
Edit Drop Post_Date_5 BTREE Yes No Post_Date 830 A
Edit Drop Post_Date_6 BTREE Yes No Post_Date 830 A
Edit Drop Post_Date_7 BTREE Yes No Post_Date 830 A
Edit Drop Post_Date_8 BTREE Yes No Post_Date 830 A
检查我的回答这个问题http://stackoverflow.com/a/16200754/757850 – 2013-04-24 19:42:54