In this Simple Post, I'll try to make an easy Trigger After Deleting data on MySQL.
The Process Was a Copying into a table : If Any Row Delete happen in Main Table, Trigger a Copy Row into a Table named like Tbl_Deleted.
Below Was The Trigger.
DROP TRIGGER /*!50032 IF EXISTS */ `db_wisuda`.`del_biodata`$$
/*!50017 DEFINER = 'root'@'localhost' */
TRIGGER `del_biodata` AFTER DELETE ON `tb_name`
FOR EACH ROW BEGIN
delete from tb_user where username = old.nim;
insert into tb_name_del
The Process was simple, If delete happen in tb_name, delete the users in tb_user and copy the data that has been deleted to tb_name_del.
Old mean the table that has been delete.
You can see username=old.nim
i have the tb_user that the tb_user username = tb_name.nim