如何更新与外键约束链接的多个元组这是我的表定义
CREATE TABLE person
(
driverId VARCHAR(10) PRIMARY KEY,
driverName VARCHAR(30),
address VARCHAR(50)
);
CREATE TABLE car
(
regNo VARCHAR(10),
model VARCHAR(25),
YEAR INT,
PRIMARY KEY(regNo)
);
CREATE TABLE accident
(
reportNo INT,
accidentDate DATE,
location VARCHAR(30),
PRIMARY KEY(reportNo)
);
CREATE TABLE participated
(
driverId VARCHAR(10),
regNo VARCHAR(10) ,
reportNo INT,
damageAmount INT,
FOREIGN KEY(driverId) REFERENCES person(driverId),
FOREIGN KEY(regNo) REFERENCES car(regNo),
FOREIGN KEY(reportNo) REFERENCES accident(reportNo),
PRIMARY KEY(driverId, regNo,reportNo)
);
CREATE TABLE owns
(
driverId VARCHAR(10),
regNo VARCHAR(10),
FOREIGN KEY(driverId) REFERENCES person(driverId),
FOREIGN KEY(regNo) REFERENCES car(regNo),
PRIMARY KEY(driverId, regNo)
);
当我执行这个命令时
UPDATE accident
SET reportNo=5555
WHERE reportNo=2222;
“PARTICIPATED”表中具有相同“reportNo”的元组没有被更新