How to delete a row from Parent table without delete a row from Child table
I want to delete开发者_JAVA技巧 a row from Parent table without deleting or modifying row in the child table. For this what type referential integrity constraints of mysql i have to use.
Could you explain the reason why you would need such a scenario?
I would consider flagging the parent row as deleted as opposed to "deleting" them permanently.
Updated: sorry, I was wrong...
Don't set referential integrity at all.
Cascade will delete children when deleting parent. Restrict will throw mySQL error. Set Null will set foreign key value in child table/tables to NULL. No Action according to this will be equivalent to Restrict.
加载中,请稍侯......
精彩评论