- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How can we create a MySQL one-time event that executes after some specified time interval?
As we know a one-time event means the events that will be executed only once on a particular schedule. To illustrate the creation of such kind of events we are using the following example in which we are creating an event which will execute after some specified time interval −
mysql> CREATE EVENT testing_event5 ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 MINUTE ON COMPLETION PRESERVE DO INSERT INTO event_message(message,generated_at) Values('Hi',NOW()); Query OK, 0 rows affected (0.06 sec) mysql> Select * from event_message; +----+---------+---------------------+ | ID | MESSAGE | Generated_at | +----+---------+---------------------+ | 1 | Hello | 2017-11-22 17:05:22 | | 2 | Hi | 2017-11-22 17:08:37 | +----+---------+---------------------+ 2 rows in set (0.00 sec)
In the above result set the message ‘Hi’ is stored after I minute interval from the current time.
- Related Articles
- How can we create a MySQL recurring event that executes after a specified time period and ends after a specified time period?
- How can we create a MySQL one-time event that executes immediately?
- How can we create multiple MySQL triggers for the same trigger event and action time?
- How can we add a time interval to date stored in a column of MySQL table?
- In MySQL, how can we display time in other format specified by the user?
- How MySQL behaves when we use INTERVAL of time unit with CURDATE() function?
- How to hide a widget after some time in Python Tkinter?
- How can we offload the time/date handling in MySQL?
- How can we start MySQL event scheduler?
- What are some of the best Indian movies of all time that we can see anytime, anywhere?
- How can we calculate the difference between two time values in MySQL?
- In MySQL, how can we represent the time value as an integer?
- Find the minimum time after which one can exchange notes in Python
- A balloon when kept in sun, bursts after some time. Why?