ON SCHEDULE EVERY 1 MONTH
mysql>
mysql> CREATE TABLE EVENTS_INVOKED
-> (EVENT_NAME VARCHAR(20) NOT NULL,
-> EVENT_STARTED TIMESTAMP NOT NULL);
Query OK, 0 rows affected (0.01 sec)
mysql>
mysql> CREATE EVENT STARTMONTH
-> ON SCHEDULE EVERY 1 MONTH
-> STARTS CURDATE() + INTERVAL 1 MONTH -
-> INTERVAL (DAYOFMONTH(CURDATE()) - 1) DAY
-> ENDS TIMESTAMP(CONCAT(YEAR(CURDATE()),'-12-31'))
-> DO INSERT INTO EVENTS_INVOKED
-> VALUES ('STARTMONTH', NOW());
Query OK, 0 rows affected (0.00 sec)
mysql>
mysql> drop table EVENTS_INVOKED;
Query OK, 0 rows affected (0.00 sec)
mysql>
Related examples in the same category