How to update table automatically in MYSQL using TRIGGER
问题 I have a table in mysql database where I am calculating New Owed Balcance based on the interest + amount borrowed... I want it to be that when the interest is altered the new owed balace changes I am using Triggers but it does not seem to update it when the interest changes DELIMITER | CREATE TRIGGER updateloan BEFORE INSERT ON loan FOR EACH ROW BEGIN SET NEW.app_amnt_owed = NEW.app_intrst +NEW. app_ln_amnt; END; | 回答1: CREATE TRIGGER updateloan_update BEFORE UPDATE ON loan FOR EACH ROW SET