2013-04-02 104 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。