我在MySql数据库中创建了两个表:
create table scope (
name_scope varchar(50) not null primary key,
description varchar(100)
);
create table value_scope (
id_value int not null primary key AUTO_INCREMENT,
name_scope varchar(50) not null,
value varchar(100) not null,
foreign key (name_scope) references scope(name_scope) ON DELETE CASCADE
);
范围可以有多个值。删除范围时;我希望它的各自值也被删除,但没有任何反应。我尝试以相反的方式做,但范围仍然存在。
我做错了什么?
答案 0 :(得分:1)
MyISAM不支持参照完整性。请使用InnoDB。