我想从存在记录的所有表中删除与学生'Petar Petrov'相关的所有记录(有三个表)
答案 0 :(得分:0)
答案 1 :(得分:0)
我猜您应该在架构中使用级联 foreign keys
。
e.g:
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
);