Navicat for mysql create foreign key table CASCADE, NO ACTION, RESTRICT, SET NULL

Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/qq_37486501/article/details/85164890

Create a table with Navicat for mysql, foreign key in time, delete and update when there are two four values ​​can be selected: CASCADE, NO ACTION, RESTRICT, SET NULL

CASCADE, NO ACTION, RESTRICT, SET NULL following differences:

  • CASCADE: the parent table delete, update, when the child table will delete, update related records out;
  • SET NULL: the parent table delete, update, when the foreign key field in the child table where the records will be associated column set to null, so pay attention when designing the child table foreign key can not be set not null;
  • RESTRICT: If you want to delete records of the parent table, and there are records associated with the parent table, you can not delete records in the parent table of the child table;
  • NO ACTION: with RESTRICT, also the first check foreign key;

Guess you like

Origin blog.csdn.net/qq_37486501/article/details/85164890