MySql foreign key constraint FOREIGN KEY REFERENCES Sora, RESTRICT, NO ACTION, CASCADE, SET NULL and other types of analysis and interpretation of action

The main table, the table [MySql]

空、RESTRICT、NO ACTION

Delete: The main table can be deleted from Table record does not exist. Unchanged deleted from the table, the main table

Update: When there is no record from the table, the main table can be updated. Update unchanged from the table, the main table

CASCADE

Delete: When you delete a table automatically deleted from the main table. Unchanged deleted from the table, the main table

Update: Automatic updates from the master table updates table. Update unchanged from the table, the main table

SET NULL

Delete: Automatic updates from the table value is NULL when you delete the main table. Unchanged deleted from the table, the main table

Update: Automatic updates from the master table updates table value is NULL. Update unchanged from the table, the main table

Guess you like

Origin blog.csdn.net/lr199966/article/details/90715505