To rotate log tables to keep a set of daily tables covering the last week
CREATE TABLE log_temp ();
DROP TABLE IF exists log_7;
RENAME TABLE log_6 TO log_7,
log_5 TO log_6,
log_4 TO log_5,
log_3 TO log_4,
log_2 TO log_3,
log_1 TO log_2,
log TO log_1,
log_tmp TO log;
Related examples in the same category