How to execute query at the turn of the day? [closed]

-1

I would like to know if there is any trigger or process that I can at day-end 00:00 change status of installments that have their due dates greater than hoje() . Any suggestions?

    
asked by anonymous 06.12.2016 / 06:06

1 answer

2

You can use a feature of MySql called Event . In a simple way a Event is a script that you set to run from time to time.

The event below will run every day at 00:20, the date entered is the date from the day the event will start ...

CREATE EVENT nome_evento
   ON SCHEDULE 
     EVERY 1 DAY
     STARTS '2016-06-12 00:20:00' ON COMPLETION PRESERVE ENABLE
  DO
    #AÇÃO A SER REALIZADA

I suggest the following readings:

Percona Article

MySql Documentation

Example Source

    
06.12.2016 / 11:29