我们如何创建一个在指定时间段后执行并在指定时间段后结束的MySQL重复事件?
众所周知,重复事件意味着它将在间隔的常规时间后执行,并在指定时间到期。为了说明此类事件的创建,我们使用以下示例,在该示例中,我们创建一个事件,该事件每分钟执行一次,一小时后过期-
mysql> CREATE EVENT testing_event10 ON SCHEDULE EVERY 1 MINUTE STARTS CURRENT_TIMESTAMP ENDS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO INSERT INTO event_message(message,generated_at) Values('Recrring evnts',NOW());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 |
| 3 | Recrring evnts | 2017-11-22 20:14:00 |
| 4 | Recrring evnts | 2017-11-22 20:15:00 |
| 5 | Recrring evnts | 2017-11-22 20:16:00 |
| 6 | Recrring evnts | 2017-11-22 20:17:00 |
| 7 | Recrring evnts | 2017-11-22 20:18:00 |
| 8 | Recrring evnts | 2017-11-22 20:19:00 |
+----+----------------+---------------------+
8 rows in set (0.00 sec)
以上是 我们如何创建一个在指定时间段后执行并在指定时间段后结束的MySQL重复事件? 的全部内容, 来源链接: utcz.com/z/322443.html