我创建了一个事件,该事件将表Loan中的值插入其中,而成员还没有在表NotYetReturned中返回到期的书。它确实将成员存储在表NotYetReturned中,但是,当我在表Loan中插入新行且成员的书已经过期时,它不会记录在表NotYetReturned中。
data X = Y { a ∷ A }
CREATE TABLE NotYetReturned LIKE Loan # First, create a table with the columns of Loan
SET GLOBAL event_scheduler = ON;
CREATE EVENT DueDate_expired
ON SCHEDULE EVERY 1 SECOND
DO INSERT INTO NotYetReturned SELECT * FROM Loan
WHERE CURDATE() > DueDate and ReturnDate is NULL;
SELECT * FROM NotYetReturned; # Check who hasn't returned their books yet
应包括新行。