1.創(chuàng)建一個(gè)測(cè)試表 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天后開(kāi)啟每天定時(shí)清空test表,一個(gè)月后停止執(zhí)行 -- 5天后開(kāi)啟每天定時(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備案號(hào):晉ICP備06003721號(hào)本站已通過(guò)國(guó)際W3C認(rèn)證
關(guān)鍵字:中聯(lián)科創(chuàng),長(zhǎng)治網(wǎng)站建設(shè),長(zhǎng)治網(wǎng)站推廣,長(zhǎng)治網(wǎng)絡(luò)工程,長(zhǎng)治軟件開(kāi)發(fā),山西網(wǎng)站建設(shè),山西軟件開(kāi)發(fā) 長(zhǎng)治五金網(wǎng)