What is an event in MySQL
MySQL what is an event, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.
A new feature, event Scheduler (EventScheduler), is added to MySQL5.1.
Events (event) are procedural database objects that MySQL calls at the appropriate time. An event can be called once or started periodically, and it is managed by a specific thread, which is called the event Scheduler.
The advantages of events
Some data timed operations no longer rely on external programs, but directly use the functions provided by the database itself. It can execute one task per second, which is very practical in some environments with high real-time requirements.
The shortcomings of the event
It is triggered regularly and cannot be called.
Create an event
A createevent statement creates an event. Each event consists of two main parts. the first part is event scheduling (eventschedule), which indicates when and how often the event starts.
The second part is the event action (eventaction), which is the code executed when the event starts. The action of the event contains a SQL statement, which may be a simple insert or update statement, or it can make a stored procedure or
Benin...end statement block, both of which allow us to execute multiple SQL.
An event can be active (open) or stopped (closed), which means that the event scheduler checks whether the event action must be called, and stopping means that the declaration of the event is stored in the directory, but the scheduler does not check whether it should be called. Immediately after an event is created, it becomes active, and an active event can be executed one or more times.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.