drop trigger if exists media_before_delete; DELIMITER // create trigger media_before_delete after delete on dbr_media for each row begin delete from dbr_media_bd where media_id = old.id; END// DELIMITER ;