DELIMITER $$
CREATE TRIGGER change_sid_trigger
AFTER update
ON student
FOR EACH ROW
BEGIN
   if (new.sid != old.sid) then
      update enroll
      set studentid = new.sid
      where studentid = old.sid;
   end if;
END $$
DELIMITER ;


