CREATE EVENT Statement event  e_hourly  deletes all rows from the  sessions  table once per hour, where this table is part of the site_activity  schema: CREATE EVENT e_hourly ON SCHEDULE EVERY 1 HOUR COMMENT ’Clears out sessions table each hour.’ DO DELETE FROM site_activity.sessions; MySQL stores the  sql_mode  system variable setting in effect when an event is created or altered, and always executes the event with this setting in force,  regardless of the current server SQL mode when the event begins executing . A  CREATE EVENT  statement that contains an  ALTER EVENT  statement in its  DO  clause appears to succeed; however, when the server attempts to execute the resulting scheduled event, the execution fails with an error. Statements such as  SELECT  or  SHOW  that merely return a result set have no effect when used in an event; the output from these is not sent to the MySQL Monitor, nor is it stored anywhere. However, you can use statements such as  SELECT ... INTO  and  INSERT INTO ... SELECT  that store a result. (See the next example in this section for an instance of the latter.) The schema to which an event belongs is the default schema for table references in the  DO  clause. Any references to tables in other schemas must be qualified with the proper schema name. As with stored routines, you can use compound-statement syntax in the  DO  clause by using the  BEGIN  and END  keywords, as shown here: delimiter | CREATE EVENT e_daily ON SCHEDULE EVERY 1 DAY 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 | delimiter ; delimiter | CREATE EVENT e ON SCHEDULE EVERY 5 SECOND DO BEGIN DECLARE v INTEGER; This example uses the  delimiter  command to change the statement delimiter. See Section 25.1, “Defining Stored Programs” . More complex compound statements, such as those used in stored routines, are possible in an event. This example uses local variables, an error handler, and a flow control construct: 2512 Note