MySQL tutorial: SHOW CREATE EVENT [EN]
top of page
CerebroSQL

MySQL: 

SHOW CREATE EVENT

Syntax:
SHOW CREATE EVENT event_name

This statement displays the CREATE EVENT statement needed to re-create
a given event. It requires the EVENT privilege for the database from
which the event is to be shown. For example (using the same event
e_daily defined and then altered in [HELP SHOW EVENTS]):

URL: https://dev.mysql.com/doc/refman/8.0/en/show-create-event.html

Example

mysql> SHOW CREATE EVENT myschema.e_daily\G
*************************** 1. row ***************************
Event: e_daily
sql_mode: ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,
NO_ZERO_IN_DATE,NO_ZERO_DATE,
ERROR_FOR_DIVISION_BY_ZERO,
NO_ENGINE_SUBSTITUTION
time_zone: SYSTEM
Create Event: CREATE DEFINER=`jon`@`ghidora` EVENT `e_daily`
ON SCHEDULE EVERY 1 DAY
STARTS CURRENT_TIMESTAMP + INTERVAL 6 HOUR
ON COMPLETION NOT PRESERVE
ENABLE
COMMENT 'Saves total number of sessions then
clears the table each day'
DO BEGIN
INSERT INTO site_activity.totals (time, total)
SELECT CURRENT_TIMESTAMP, COUNT(*)
FROM site_activity.sessions;
DELETE FROM site_activity.sessions;
END
character_set_client: utf8mb4
collation_connection: utf8mb4_0900_ai_ci
Database Collation: utf8mb4_0900_ai_ci

bottom of page