1.創(chuàng )建一個(gè)測試表 CREATE TABLE aaa (timeline TIMESTAMP); 2.創(chuàng )建一個(gè)事件:每秒插入一條記錄到數據表 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天后停止執行 -- 每天定時(shí)情況aaa表,5天后停止執行 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天后開(kāi)啟每天定時(shí)清空test表,一個(gè)月后停止執行 -- 5天后開(kāi)啟每天定時(shí)清空test表,一個(gè)月后停止執行 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.
電話(huà):0355-3728808 傳真:0355-3728808
ICP備案號:晉ICP備06003721號本站已通過(guò)國際W3C認證
關(guān)鍵字:中聯(lián)科創(chuàng ),長(cháng)治網(wǎng)站建設,長(cháng)治網(wǎng)站推廣,長(cháng)治網(wǎng)絡(luò )工程,長(cháng)治軟件開(kāi)發(fā),山西網(wǎng)站建設,山西軟件開(kāi)發(fā) 長(cháng)治五金網(wǎng)