ALTER TABLE vn.referenceRate DROP INDEX `PRIMARY`; ALTER TABLE vn.referenceRate ADD id INT auto_increment PRIMARY KEY; ALTER TABLE vn.referenceRate CHANGE id id int(11) auto_increment NOT NULL FIRST; CREATE UNIQUE INDEX referenceRate_currencyFk_IDX USING BTREE ON vn.referenceRate (currencyFk,dated);