简体   繁体   English

关于外键删除销毁子行?

[英]On foreign key delete destroy child rows?

I'm pretty new to using foreign keys, and can't really find anything on the MySQL website.我对使用外键很陌生,在 MySQL 网站上找不到任何东西。 Here is my database structure:这是我的数据库结构:

hosts
    id
    etc.
events
    id
    host_id
    etc.

One or multiple events belong to a host .一个或多个events属于一个host When the host is deleted I need all events attached to it to be deleted.host被删除时,我需要删除所有附加到它的events How can I achieve this?我怎样才能做到这一点?

Thanks!谢谢!

use case cade on delete properly用例 cade 正确删除

You can check details here -您可以在此处查看详细信息-

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM