I have a problem where I need to copy a table from MYSQL using this:
CREATE TABLE newtable LIKE oldtable;
INSERT newtable SELECT * FROM oldtable;
I need to drop that table weekly and create them again because I dont want to lose the original data. Can anyone help me to find a solution where it can be done automatically. I really have no idea about that
What if you have a java program, where you're having the
MySQL
query and let the query be executed automatically through acron job
periodically.Where you can maybe have two separate threads running, or you could do it within the same thread it self. ie, executing the
INSERT
into the newtable and then maybe you can simply drop the old ones.OR you could go with the MySQL Event Scheduler. This SO pretty much explains the effective way of going ahead with this as per your requirement.