My create table command in mysql is
CREATE TABLE `map` (
`id` int(4) AUTO_INCREMENT NOT NULL,
`city` varchar(100) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE = InnoDB;
CREATE UNIQUE INDEX `map_city_idx`
ON `map`
(`city`);
Intial value, like:
id(1),city('Banda Aceh')
id(2),city('Medan')
The next insert is city('Medan'), so it's error because city column is unique. The next insert is city('Bengkulu'), and the final table result is
id(1), city('Banda Aceh')
id(2), city('Medan')
id(4), city('Bengkulu')
It's not id(3) but id(4) instead. So how could I keep sequential primary key eventhough there was/were insert error before?
id(1), city('Banda Aceh')
id(2), city('Medan')
id(3), city('Bengkulu')