Delete a record from the database when the deadline expires

1

How can I automatically delete a record from the MYSQL database when it reaches a deadline? remembering I'm using a date_termino attribute of type Date

    
asked by anonymous 20.11.2017 / 19:00

1 answer

0
DELETE FROM table WHERE data_termino < '2017-09-21 00:00:00';

or if it's a date, use > .. and so on.

You can do something more automated eg: (last 6 months)

delete from table where data_termino name < DATE_SUB(NOW() , INTERVAL 6 MONTH)

If you want a range use BETWEEN

    
20.11.2017 / 19:01