du kan bruge mysql trigger til at gøre dette. Prøv noget lignende
CREATE TRIGGER 'database_name'.'after_insert_enrollment' AFTER INSERT ON 'ENROLLMENT'
FOR EACH ROW
BEGIN
UPDATE class SET NO_OF_STUDENTS = NO_OF_STUDENTS +1 WHERE CLASS_NO = NEW.CLASS_NO;
END