
- 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 immediately?
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 at the current time −
Example
mysql> Create table event_message(ID INT NOT NULL PRIMARY KEY AUTO_INCREMENT, MESSAGE VARCHAR(255) NOT NULL, Generated_at DATETIMENOT NULL); Query OK, 0 rows affected (0.61 sec) mysql> CREATE EVENT testing_event ON SCHEDULE AT CURRENT_TIMESTAMP DO INSERT INTO event_message(message,generated_at) Values('Hello',NOW()); Query OK, 0 rows affected (0.00 sec) mysql> Select * from event_message; +----+---------+---------------------+ | ID | MESSAGE | Generated_at | +----+---------+---------------------+ | 1 | Hello | 2017-11-22 17:05:22 | +----+---------+---------------------+ 1 row in set (0.00 sec)
- Related Articles
- How can we create a MySQL one-time event that executes after some specified time interval?
- 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 multiple MySQL triggers for the same trigger event and action time?
- How can we start MySQL event scheduler?
- How can we modify an existing MySQL event?
- How can we RENAME an existing MySQL event?
- How can we ENABLE AND DISABLE a particular MySQL event?
- How can we delete an existing MySQL event permanently?
- How can we create MySQL views?
- How can we create and use a MySQL trigger?
- How can we create a MySQL view with a subquery?
- How can we create a MySQL stored function that uses the dynamic data from a table?
- How can we create a MySQL view with LEFT JOIN?
- How can we create a MySQL view with INNER JOIN?
- How can we create a MySQL view with RIGHT JOIN?

Advertisements