I have table “book” and “store_order” have relation
I want to make trigger(but it contain error):
DELIMITER $$ CREATE TRIGGER t1 before delete ON store_order FOR EACH ROW BEGIN update book set number = number + NEW.quantity where ISBN = NEW.ISBN; END $$ DELIMITER ;
Advertisement
Answer
DELIMITER $$ CREATE TRIGGER t2 AFTER delete ON library.store_order FOR EACH ROW BEGIN update library.book set library.book.number = (library.book.number + OLD.quantity) where library.book.ISBN = OLD.ISBN; END$$ DELIMITER ;