Cascade MySQL foreign key settings of, No action, Restrict, Set default

. Cascade mode
when update / delete records in the parent table, the synchronization update / delete records in the child table matches out

. Set null mode
when the update / delete records in the parent table, the sub-match record on the table columns set to null
to pay attention to the child table foreign key column can not not null

. No action mode
if the matching record in the child table is not allowed to the parent table corresponds to a candidate key update / delete operations

. Restrict way
with no action, foreign key constraints are checked immediately

. Set default mode
parent table when there is a change, the sub-table as a foreign key column provided default values, but can not identify Innodb

Reprinted from http://blog.sina.com.cn/s/blog_91339bff0100ymc2.html

Guess you like

Origin blog.csdn.net/xiao_xiao_b/article/details/92839345