我想在SQL中更改/更新表的主键。我使用Wampserver。但是这个主键被用作其他3个表的外部主键,我不能更改它。知道怎么回事吗?我是否可以禁用FK,然后重新启用它们,它们将拥有新的PK?在带有PK的表格中,有5-6个PK,但我只想更改其中的一个。
CREATE TABLE party(
name varchar(40) COLLATE utf8_general_ci NOT NULL primary key,
id integer not null,
foreign key (id) references arxhgos(id)
);
CREATE TABLE boul(
id integer not null,
foreign key (id) references person(id),
part_n varchar(40) COLLATE utf8_general_ci NOT NULL,
foreign key (part_n) references party(name),
date_beg date not null,
date_end date
);发布于 2014-02-07 12:07:32
您必须设置所谓的级联更新。
https://stackoverflow.com/questions/21617434
复制相似问题