
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Create MySQL One-Time Event After 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 −
Example
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.
Advertisements