13.5.4.5. SHOW CREATE EVENT
SHOW CREATE EVENT event_name
This statement displays the CREATE TABLE
statement needed to re-create a given event. For example
(using the same event e_daily
defined and
then altered in Section 13.5.4.13, “SHOW EVENTS
”):
mysql> SHOW CREATE EVENT test.e_daily\G
*************************** 1. row ***************************
Event: e_daily
Create Event: CREATE EVENT e_daily
ON SCHEDULE EVERY 1 DAY
STARTS CURRENT_TIMESTAMP + INTERVAL 6 HOUR
ENABLE
COMMENT 'Saves total number of sessions and
clears the table once per day.'
DO
BEGIN
INSERT INTO site_activity.totals (when, total)
SELECT CURRENT_TIMESTAMP, COUNT(*)
FROM site_activity.sessions;
DELETE FROM site_activity.sessions;
END
Note that the output reflects the current status of the event
(ENABLE
) rather than the status with which
it was created.
This statement was implemented in MySQL 5.1.6.