0

我想知道我是否正确实施了它,或者是否相反。

所以我有3张桌子:

TableParent,TableChildAnotherTable

TableParent有个PK叫id

TableChild并且AnotherTable有一个 PK 也称为id它也是一个 FK 约束TableParent.id,它有ON DELETE CASCADE

我对其建模认为,如果我删除 中的一行,则其中的TableParent每一行都将被自动删除。TableChildAnotherTable

它是这样工作的吗?(使用 MySQL,引擎 InnoDB)

4

1 回答 1

0

Was going to post this in a comment, but the comment button is not showing up.

Check out this quesion/answer. I think it has all you need and more on this issue.

MySQL foreign key constraints, cascade delete

I could retype it all, but that seems redundent.

于 2013-07-24T00:45:52.583 回答