Mysql – Update Column in table on midnight daily

MySQLupdate

I am designing a simple 1 table database in mySQL that will have two columns. One column will be the name of a specific restaurant on the webpage I will be using this database with. The second column will be number of reservations at each restaurant.

I'm a mySQL rookie and i was wondering if there is a way to set up a script or cronjob that everyday at midnight would run an UPDATE command against my table to reset all reservation values to 0.

Best Answer

You can write a simple script externally or use the MySQL event scheduler. Both will work just fine. The benefit of the MySQL event scheduler is that it will be part of your database backups.