Trigger before delete MySql

后端 未结 3 1629
说谎
说谎 2020-12-11 20:51

I have a table named user. This table has a foreign key to a department table. One user can be associated with one department. Before deleting a department, I would like to

3条回答
  •  醉话见心
    2020-12-11 21:40

    You can use any sql statement in your trigger code. When a record is deleted the trigger-code is fired. You can use the record wich fired the trigger (to select the department id) and then select any user with that id and update that user record. Good luck

提交回复
热议问题