mysql auto-increment on a non-primary key
问题 Another question today :) This time I'd like to know if/how it's possible to make a second column auto-increment for each primary key: CREATE TABLE test ( `id` INTEGER UNSIGNED NOT NULL, `subId` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT, `text` VARCHAR(45) NOT NULL, PRIMARY KEY (`id`, `subId`) ) ENGINE = InnoDB; This creation, unfortunately, doesn't work, only if I specify ID as primary key and subId as index key (but I need them both together and ID can repeat...) Example data (what I need):