Slexy.org is shutting down and stopped accepting new Pastes on May 4th, 2021.
Existing Pastes will stop being available on or after May 10th, 2021.
Author: Not specified Language: sql
Description: Not specified Timestamp: 2017-10-04 01:17:19 +0000
View raw paste Reply
DELIMITER $$
CREATE TRIGGER update_avgrating
        AFTER INSERT ON shelf
        FOR EACH ROW
BEGIN
        UPDATE book SET avgrating=(SELECT AVG(rating) FROM shelf WHERE shelf.isbn = book.isbn) WHERE book.isbn = NEW.isbn;
END$$
DELIMITER ;

 
View raw paste Reply