0

Is it possible to alter a table's multiple (compound) column key?

Example table:

CREATE TABLE `test_abc` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `one` varchar(64) NOT NULL,
  `two` mediumint(8) unsigned NOT NULL,
  `three` varchar(128) NOT NULL,
  `four` datetime(3) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uk_abc` (`one`,`three`,`two`,`four`)
) ENGINE=InnoDB;

I would like to alter the key:

UNIQUE KEY `uk_abc` (`one`,`three`,`two`,`four`)

to:

UNIQUE KEY `uk_abc` (`one`,`two`,`three`,`four`)
Jimmix
  • 5,644
  • 6
  • 44
  • 71

1 Answers1

1

Use this please

ALTER TABLE test_abc
   DROP INDEX `uk_abc`, 
   ADD UNIQUE KEY `uk_abc` (`one`,`two`,`three`,`four`)
nbk
  • 45,398
  • 8
  • 30
  • 47