我想创建一个映射表,其中包含三个表。当我运行表创建SQL时,它显示类似
的错误SQL错误(1022):无法写入;表'mytable'中的重复键
CREATE TABLE `mytable` (
`id_one` BIGINT(20) NOT NULL,
`id_two` BIGINT(20) NOT NULL,
`id_three` BIGINT(20) NOT NULL,
`attribute_one` BIGINT(20) NOT NULL,
CONSTRAINT PRIMARY KEY (`id_one`, `id_two`, `id_three`, `attribute_one`),
CONSTRAINT `fk_one` FOREIGN KEY (`id_one`) REFERENCES `table_one` (`id_one`),
CONSTRAINT `fk_two` FOREIGN KEY (`id_two`) REFERENCES `table_two` (`id_two`),
CONSTRAINT `fk_three` FOREIGN KEY (`id_three`) REFERENCES `table_three` (`id_three`)
);
我的问题是为什么它会产生错误,如在创建表时重复。我该如何克服这个问题。