I Want to know if I implemented it right or if it is the other way around.
So I have 3 tables:
TableParent
, TableChild
and AnotherTable
TableParent
has a PK called id
TableChild
and AnotherTable
has a PK also called id
that is also a FK Constraint to TableParent.id
and it has ON DELETE CASCADE
I modeled it thinking that if I delete a row in TableParent
, every row in TableChild
and AnotherTable
will be auto deleted.
Does it works that way? (Using MySQL, engine InnoDB)
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.