2013/7/6 Rafael Ribeiro - iPhone <rafaelribeiro...@gmail.com>

> Dear Coleagues,
>
> I would like to listen your opinion about a situation.
>
> There is a function that is able to REMOVE all data from an specific date ?
>

are you talking about removing whole data from the tables or just specific
data inserted at some time?

you can do this different ways..

First way:
1) add a field indicating current time of insertion (for example:
insert_date)
2) DELETE FROM table WHERE insert_date <= DATE_SUB(NOW(),INTERVAL 3 HOURS)
3) set up a cronjob to execute this php script every 3 hours or you can
just delete data via cronjob (all data):

Second way:
1) TRUNCATE table
2) also via cronjob running every 3 hours



> I mean ... We are developing a demo script website, where users can join
> and test our system.
>
> We need a database reset every 3 hours ... Delete all new data and back
> all changes to a default point.
>
> Better do that with php or mysql has an internal function that handle this.
>
> Rafael Ribeiro
> Sent by iPhone
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql
>
>

Reply via email to