Search code examples
mysqlinnodbsql-deletecascading-deletesdatabase-relations

CASCADE when defining relations in InnoDB


I'm wondering what does represent CASCADE when defining relations in InnoDB?

I see it's something related to actions: ON DELETE & ON UPDATE.

Do I have to set it to CASCADE on every relation in my tables?


Solution

  • If a row is deleted and one of its member is foriegn key elsewhere then then all rows in all tables which reference it as foreign key are also deleted.

    Read: http://en.wikipedia.org/wiki/Foreign_key