
DELIMITER $$

DROP TRIGGER IF EXISTS `vn`.`creditInsurance_AFTER_INSERT` $$

CREATE DEFINER=`root`@`%` TRIGGER `vn`.`creditInsurance_afterInsert` AFTER INSERT ON `creditInsurance` FOR EACH ROW
BEGIN
	UPDATE `client` c
		JOIN vn.creditClassification  cc ON cc.client = c.id
        SET creditInsurance = NEW.credit WHERE cc.id = NEW.creditClassification;
        
END$$
DELIMITER ;
