How do we ban the removal of daughter records foreign key?



  • Hello, everyone. There are two tables (A-B) and they are connected fk(foreign key) to one field. How do the daughter key not be removed when the parent key is removed with the help of ON DELETE CASCADE, and the record stayed in the table?



  • In your case, it's fine. http://www.mysql.ru/docs/man/SEC451.html

    When removed, the value will be determined NULL


    If you just take it away ON DELETE CASCADE

    There's a mistake in the removal.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2