开发者

MySQL - Connecting two tables via a Join table - Do all 3 tables need to use the InnoDB engine?

开发者 https://www.devze.com 2023-02-15 04:58 出处:网络
I have 2 tables. Cla开发者_StackOverflow社区sses and students. I want to create a table which holds two columns class_ID and student_ID.

I have 2 tables. Cla开发者_StackOverflow社区sses and students. I want to create a table which holds two columns class_ID and student_ID. My question ,as a mySQL noob, is do all 3 tables need to be set as innoDB so tha I can benefit from cascades if say a student or a class is deleted? Many thanks.


Yes, it would indeed seem that all tables must be of type innoDB.


You're correct that you'll need to use InnoDB to get support for foreign keys. However, you don't need foreign keys to do cascading deletes as MySQL supports multi-table delete statements. Admittedly, foreign keys simplify things nicely and are probably the way to go.

0

精彩评论

暂无评论...
验证码 换一张
取 消