Reputation: 70
Is there any possibility of deleting a table from a database automatically, after a period of time?
If so, how is it achievable?
Upvotes: 0
Views: 183
Reputation: 89651
You can use any sort of scheduler: https://dev.mysql.com/doc/refman/5.7/en/event-scheduler.html
Just execute DROP table at that time.
If there are more specific criteria, you could do any number of things, like dropping tables that have not had INSERTs or UPDATEs in a certain time (using a trigger to know when they are modified and keeping track of that in a table and then when that date is a certain age, DROP the table).
This is kind of unusual, as tables tend to not be DROPped, normally data is selectively DELETEd in archive processes but the table sticks around.
Upvotes: 1