what does this query do?
CREATE EVENT reset
ON SCHEDULE EVERY 1 DAY
STARTS '2010-6-20 00:00:01'
DO UPDATE `MY_DB`.`MY_table` SET `field` = '0';
what does this query do?
CREATE EVENT reset
ON SCHEDULE EVERY 1 DAY
STARTS '2010-6-20 00:00:01'
DO UPDATE `MY_DB`.`MY_table` SET `field` = '0';
Creates a recurring scheduled event that will update the specified database's specified table's specified field to 0 in all rows every 24 hours, starting at 1 second after midnight on the 20th of June, 2010.
Creating scheduled events: http://dev.mysql.com/doc/refman/5.1/en/create-event.html
Every day at 00:00:01
starting from 2010/06/20
the column field
inside MY_table
will be set to "0"
It creates a recurring scheduled event that runs everyday at midnight plus one second, starting from today, which runs the following statement:
UPDATE `MY_DB`.`MY_table` SET `field` = '0';
This will set the field
attribute of all the rows in MY_table
to 0
.
You may want to check out: