0

次の表を取得しました。

CREATE TABLE `unsub_counts` (
 `count_id` int(11) NOT NULL AUTO_INCREMENT,
 `unsub_date` date DEFAULT NULL,
 `unsub_count` int(11) DEFAULT NULL,
 `store_id` smallint(5) DEFAULT NULL,
 PRIMARY KEY (`count_id`),
 UNIQUE KEY `uc_unsub_date` (`unsub_date`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

unsub_dateuniqueです。に一意のインデックスが必要なので、その一意性を削除したいと思いますunsub_date + store_id

ネットで提案を見つけましたが、失敗しています:

ALTER TABLE `unsub_counts` DROP CONSTRAINT `unsub_date`

教えてください:SQL構文にエラーがあります。unsub_date1行目の「CONSTRAINT」付近で使用する正しい構文については、MySQLサーバーのバージョンに対応するマニュアルを確認してください

これは MyISAM に関連していますか? 他の提案はありますか?

4

1 に答える 1

1

drop index制約名とともに使用:

ALTER TABLE unsub_counts DROP INDEX uc_unsub_date;

あるいは単に:

drop index uc_unsub_date on unsub_counts;
于 2012-12-01T11:50:39.593 に答える