ON SCHEDULE EVERY 3 MONTH : Schedule « Event « SQL / MySQL






ON SCHEDULE EVERY 3 MONTH

     
mysql>
mysql> CREATE TABLE EVENTS_INVOKED
    ->       (EVENT_NAME      VARCHAR(20) NOT NULL,
    ->        EVENT_STARTED   TIMESTAMP NOT NULL);
Query OK, 0 rows affected (0.00 sec)

mysql>
mysql>
mysql> CREATE EVENT QUARTERS
    ->    ON SCHEDULE EVERY 3 MONTH
    ->       STARTS (CURDATE() - INTERVAL (DAYOFMONTH(CURDATE())
    ->       - 1) DAY) - INTERVAL (MOD(MONTH(CURDATE()
    ->       - INTERVAL (DAYOFMONTH(CURDATE()) - 1) DAY)+2,3)) MONTH
    ->       + INTERVAL 3 MONTH
    ->    DO INSERT INTO EVENTS_INVOKED VALUES ('QUARTERS', 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

1.Event schedule start with case clause
2.Event schedule every week
3.ON SCHEDULE AT NOW()
4.ON COMPLETION PRESERVE
5.ON SCHEDULE EVERY 1 MONTH