Another question today :)
This time I would like to know if it is possible / possible to make the second step 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, does not work, only if I specify IDas the primary key and subIdas the index key (but I need them together, but I IDcan repeat ...)
Examples of data (what I need):
1, 1
1, 2
1, 3
2, 1
2, 2
3, 1
The problem with creating the IDprimary index subIdis that it subIdwill increase regardless ID.
How to achieve this, and is it possible?
source
share