2013-04-02 103 views
0

我已经创建了一个MySQL数据库中的两个表:ON DELETE CASCADE不起作用

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

什么是您的数据库引擎? – raina77ow

+0

我正在使用HeidiSQL(MySQL) – salamey

+0

这是客户端;例如,我问过有关数据库引擎 - MyISAM或InnoDB。顺便说一句,使用什么版本的MySQL? – raina77ow

回答

1

MyISAM不支持参照完整性。请改用InnoDB。