假设我有一个表table3
,它包含两个外键,每个外键引用一个不同的表。我想知道,我可以ON DELETE
为他们定义两个不同的动作。
让我通过一个例子来解释它。
create table table3 (
ID varchar(255),
Name varchar(255),
primary key(ID,Name),
foreign key(ID) References user(id),
foreign key(Name) References shops(StoreName)
on update cascade
on delete cascade // I want to cascade table if id is deleted
on delete no actions); // and do not allowed if StoreName is deleted.
有没有人可以帮助我?提前致谢。