Cascade, NOACTION, Restrict, SETNULL bitsCN.com in Mysql
Cascade, no action, Restrict, set null in Mysql
Meanings of foreign key constraints on subtables:
If no candidate key is found in the parent table, insert/update is not allowed in the child table.
Description of the foreign key constraint on the parent table:
When updating or deleting a parent table to update or delete one or more candidate keys that match the row in the child table, the behavior of the parent table depends on: the on update/on delete clause specified when defining the foreign key of the sub-table. InnoDB supports five methods, which are listed as follows:
Cascade mode
When updating/deleting records in the parent table, synchronize update/delete matching records in the child table
On delete cascade is available from mysql3.23.50; on update cascade is available from mysql4.0.8
Set null
When updating/deleting records in the parent table, set the columns of matched records in the child table to null.
Note that the foreign key column of the sub-table cannot be not null.
On delete set null is available from mysql3.23.50; on update set null is available from mysql4.0.8
No action method
If the child table has matched records, the update/delete operation on the candidate keys corresponding to the parent table is not allowed.
This is ANSI SQL-92 standard, supported since mysql4.0.8
Restrict mode
The same as no action, both check foreign key constraints immediately
BitsCN.com