我想从存在记录的所有表中删除与学生“Petar Petrov”相关的所有记录(共有三个表)
问问题
130 次
2 回答
0
我想你应该在你的模式中使用级联。 foreign keys
例如:
create table students (
id int,
constraint pk_students primary key (id)
);
create table a(
s_id int,
constraint fk_a_student foreign key (s_id) references students on delete cascade
);
create table b(
s_id int,
constraint fk_b_student foreign key (s_id) references students on delete cascade
);
于 2013-04-08T12:12:18.833 回答