create table bla_di_da(bla int,di int, da int); alter table bla_di_da add index (di); alter table bla_di_da add index (di); alter table bla_di_da add index (di); a) The 2nd and 3rd ALTERs will fail b) All the ALTERs will run fine and 3 indexes will be the result c) All the ALTERs will run fine and 1 index will be the result
[ Just for fun ]
b
Three indexes on the same column will be created! If seen this in production databases, and it just makes things slow and uses extra storage. When creating DDL, give indexes a name, then this cannot happen.
MariaDB [tt]> show create table bla_di_da\G
*************************** 1. row ***************************
Table: bla_di_da
Create Table: CREATE TABLE `bla_di_da` (
`bla` int(11) DEFAULT NULL,
`di` int(11) DEFAULT NULL,
`da` int(11) DEFAULT NULL,
KEY `di` (`di`),
KEY `di_2` (`di`),
KEY `di_3` (`di`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
1 row in set (0.00 sec)