1.創(chuàng)建一個(gè)測試表 CREATE TABLE aaa (timeline TIMESTAMP); 2.創(chuàng)建一個(gè)事件:每秒插入一條記錄到數(shù)據(jù)表 CREATE EVENT e_test_insert ON SCHEDULE EVERY 1 SECOND DO INSERT INTO aaa VALUES (CURRENT_TIMESTAMP); 3.每天定時(shí)清空aaa表: -- 每天定時(shí)情況aaa表 CREATE EVENT e_test on schedule every 1 DAY starts timestamp '2016-12-19 12:00:00' do truncate table aaa; 4.每天定時(shí)情況aaa表,5天后停止執(zhí)行 -- 每天定時(shí)情況aaa表,5天后停止執(zhí)行 drop event if exists e_test; create event e_test on schedule every 1 day ends current_timestamp + INTERVAL 5 day do truncate table aaa; 5.5天后開啟每天定時(shí)清空test表,一個(gè)月后停止執(zhí)行 -- 5天后開啟每天定時(shí)清空test表,一個(gè)月后停止執(zhí)行 CREATE EVENT e_test ON SCHEDULE EVERY 1 DAY STARTS CURRENT_TIMESTAMP + INTERVAL 5 DAY ENDS CURRENT_TIMESTAMP + INTERVAL 1 MONTH DO TRUNCATE TABLE aaa; |
2006-2014 IT0355.com 山西中聯(lián)科創(chuàng)科技有限公司. All Rights Reserved.
電話:0355-3728808 傳真:0355-3728808
ICP備案號:晉ICP備06003721號本站已通過國際W3C認(rèn)證
關(guān)鍵字:中聯(lián)科創(chuàng),長治網(wǎng)站建設(shè),長治網(wǎng)站推廣,長治網(wǎng)絡(luò)工程,長治軟件開發(fā),山西網(wǎng)站建設(shè),山西軟件開發(fā) 長治五金網(wǎng)