0
我创建MySQL中的两个表,子表没有被删除
- 客户
房子表houseID是在我的客户表的外键。
Create customer table( id int not null primary key auto_increment, name varchar not null, houseId int not null, telephoneNo, int not null, CONSTRAINT FOREIGN KEY (houseId) REFERENCES house(id) ON DELETE CASCADE); CREATE house table(id int not null primary key auto_increment, houseNo int not null, address varchar not null);
然而,当我删除用户与特定houseId,在内部表中的行没有被删除,虽然我在客户表放在删除级联。任何想法为什么?
那么我是否需要将customerID作为外键放在内部表中? – Sne
啊,它现在正在工作!谢谢! – Sne
欢迎来到堆栈溢出。请记住将问题标记为已回答:) – Moak