MySQL timed events

Source: Internet
Author: User

1. Create a test table

CREATE TABLE TIMESTAMP);

2. Create an event: Insert a record into the datasheet every second

CREATEon1  SECOND  INSERTintoVALUES ( current_timestamp);

3. Clear the AAA table regularly every day:

-- Daily Timing Status AAA table CREATE  on 1  Day  timestamp'2016-12-19 12:00:00'truncate table AAA;

4. Daily AAA table, 5 days after the execution of the stop

-- 5 days after the day of the AAA table, stop execution Drop if exists e_test; Create Event E_test  on 1  Day  current_timestamp+5Daytruncate table AAA;

5.5 days after the start of the daily emptying test table, after one months to stop execution

-- 5 days after the start of the daily emptying test table, after one months to stop execution CREATE  on1daycurrent_timestamp+5Day  current_timestamp + 1 MONTHTRUNCATE    TABLE aaa;

MySQL timed events

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.