<div id="docs-body">
 <div class="section">
  <div class="titlepage">
   <div>
    <div>
     <h3 class="title">
      <a name="information-schema-events-table">
      </a>
      28.3.14 The INFORMATION_SCHEMA EVENTS Table
     </h3>
    </div>
   </div>
  </div>
  <a class="indexterm" name="idm46045079981040">
  </a>
  <p>
   The
   <a class="link" href="information-schema-events-table.html" title="28.3.14 The INFORMATION_SCHEMA EVENTS Table">
    <code class="literal">
     EVENTS
    </code>
   </a>
   table provides information
      about Event Manager events, which are discussed in
   <a class="xref" href="event-scheduler.html" title="27.4 Using the Event Scheduler">
    Section 27.4, “Using the Event Scheduler”
   </a>
   .
  </p>
  <p>
   The
   <a class="link" href="information-schema-events-table.html" title="28.3.14 The INFORMATION_SCHEMA EVENTS Table">
    <code class="literal">
     EVENTS
    </code>
   </a>
   table has these columns:
  </p>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <code class="literal">
       EVENT_CATALOG
      </code>
     </p>
     <p>
      The name of the catalog to which the event belongs. This value
          is always
      <code class="literal">
       def
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       EVENT_SCHEMA
      </code>
     </p>
     <p>
      The name of the schema (database) to which the event belongs.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       EVENT_NAME
      </code>
     </p>
     <p>
      The name of the event.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       DEFINER
      </code>
     </p>
     <p>
      The account named in the
      <code class="literal">
       DEFINER
      </code>
      clause
          (often the user who created the event), in
      <code class="literal">
       '
       <em class="replaceable">
        <code>
         user_name
        </code>
       </em>
       '@'
       <em class="replaceable">
        <code>
         host_name
        </code>
       </em>
       '
      </code>
      format.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       TIME_ZONE
      </code>
     </p>
     <p>
      The event time zone, which is the time zone used for
          scheduling the event and that is in effect within the event as
          it executes. The default value is
      <code class="literal">
       SYSTEM
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       EVENT_BODY
      </code>
     </p>
     <p>
      The language used for the statements in the event's
      <a class="link" href="do.html" title="15.2.3 DO Statement">
       <code class="literal">
        DO
       </code>
      </a>
      clause. The value is always
      <code class="literal">
       SQL
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       EVENT_DEFINITION
      </code>
     </p>
     <p>
      The text of the SQL statement making up the event's
      <a class="link" href="do.html" title="15.2.3 DO Statement">
       <code class="literal">
        DO
       </code>
      </a>
      clause; in other words, the
          statement executed by this event.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       EVENT_TYPE
      </code>
     </p>
     <p>
      The event repetition type, either
      <code class="literal">
       ONE TIME
      </code>
      (transient) or
      <code class="literal">
       RECURRING
      </code>
      (repeating).
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       EXECUTE_AT
      </code>
     </p>
     <p>
      For a one-time event, this is the
      <a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
       <code class="literal">
        DATETIME
       </code>
      </a>
      value specified in the
      <code class="literal">
       AT
      </code>
      clause of the
      <a class="link" href="create-event.html" title="15.1.13 CREATE EVENT Statement">
       <code class="literal">
        CREATE EVENT
       </code>
      </a>
      statement used to
          create the event, or of the last
      <a class="link" href="alter-event.html" title="15.1.3 ALTER EVENT Statement">
       <code class="literal">
        ALTER
          EVENT
       </code>
      </a>
      statement that modified the event. The value
          shown in this column reflects the addition or subtraction of
          any
      <code class="literal">
       INTERVAL
      </code>
      value included in the event's
      <code class="literal">
       AT
      </code>
      clause. For example, if an event is
          created using
      <code class="literal">
       ON SCHEDULE AT CURRENT_TIMESTAMP +
          '1:6' DAY_HOUR
      </code>
      , and the event was created at
          2018-02-09 14:05:30, the value shown in this column would be
      <code class="literal">
       '2018-02-10 20:05:30'
      </code>
      . If the event's
          timing is determined by an
      <code class="literal">
       EVERY
      </code>
      clause
          instead of an
      <code class="literal">
       AT
      </code>
      clause (that is, if the
          event is recurring), the value of this column is
      <code class="literal">
       NULL
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       INTERVAL_VALUE
      </code>
     </p>
     <p>
      For a recurring event, the number of intervals to wait between
          event executions. For a transient event, the value is always
      <code class="literal">
       NULL
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       INTERVAL_FIELD
      </code>
     </p>
     <p>
      The time units used for the interval which a recurring event
          waits before repeating. For a transient event, the value is
          always
      <code class="literal">
       NULL
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       SQL_MODE
      </code>
     </p>
     <p>
      The SQL mode in effect when the event was created or altered,
          and under which the event executes. For the permitted values,
          see
      <a class="xref" href="sql-mode.html" title="7.1.11 Server SQL Modes">
       Section 7.1.11, “Server SQL Modes”
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       STARTS
      </code>
     </p>
     <p>
      The start date and time for a recurring event. This is
          displayed as a
      <a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
       <code class="literal">
        DATETIME
       </code>
      </a>
      value,
          and is
      <code class="literal">
       NULL
      </code>
      if no start date and time are
          defined for the event. For a transient event, this column is
          always
      <code class="literal">
       NULL
      </code>
      . For a recurring event whose
          definition includes a
      <code class="literal">
       STARTS
      </code>
      clause, this
          column contains the corresponding
      <a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
       <code class="literal">
        DATETIME
       </code>
      </a>
      value. As with the
      <code class="literal">
       EXECUTE_AT
      </code>
      column, this value resolves any
          expressions used. If there is no
      <code class="literal">
       STARTS
      </code>
      clause affecting the timing of the event, this column is
      <code class="literal">
       NULL
      </code>
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       ENDS
      </code>
     </p>
     <p>
      For a recurring event whose definition includes a
      <code class="literal">
       ENDS
      </code>
      clause, this column contains the
          corresponding
      <a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
       <code class="literal">
        DATETIME
       </code>
      </a>
      value.
          As with the
      <code class="literal">
       EXECUTE_AT
      </code>
      column, this value
          resolves any expressions used. If there is no
      <code class="literal">
       ENDS
      </code>
      clause affecting the timing of the
          event, this column is
      <code class="literal">
       NULL
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       STATUS
      </code>
     </p>
     <p>
      The event status. One of
      <code class="literal">
       ENABLED
      </code>
      ,
      <code class="literal">
       DISABLED
      </code>
      , or
      <code class="literal">
       REPLICA_SIDE_DISABLED
      </code>
      (prior to MySQL
          8.2.0, this was
      <code class="literal">
       SLAVESIDE_DISABLED
      </code>
      , now
          deprecated).
      <code class="literal">
       REPLICA_SIDE_DISABLED
      </code>
      indicates that the creation of the event occurred on another
          MySQL server acting as a replication source and replicated to
          the current MySQL server which is acting as a replica, but the
          event is not presently being executed on the replica. For more
          information, see
      <a class="xref" href="replication-features-invoked.html" title="19.5.1.16 Replication of Invoked Features">
       Section 19.5.1.16, “Replication of Invoked Features”
      </a>
      . information.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       ON_COMPLETION
      </code>
     </p>
     <p>
      One of the two values
      <code class="literal">
       PRESERVE
      </code>
      or
      <code class="literal">
       NOT PRESERVE
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       CREATED
      </code>
     </p>
     <p>
      The date and time when the event was created. This is a
      <a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
       <code class="literal">
        TIMESTAMP
       </code>
      </a>
      value.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       LAST_ALTERED
      </code>
     </p>
     <p>
      The date and time when the event was last modified. This is a
      <a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
       <code class="literal">
        TIMESTAMP
       </code>
      </a>
      value. If the event
          has not been modified since its creation, this value is the
          same as the
      <code class="literal">
       CREATED
      </code>
      value.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       LAST_EXECUTED
      </code>
     </p>
     <p>
      The date and time when the event last executed. This is a
      <a class="link" href="datetime.html" title="13.2.2 The DATE, DATETIME, and TIMESTAMP Types">
       <code class="literal">
        DATETIME
       </code>
      </a>
      value. If the event
          has never executed, this column is
      <code class="literal">
       NULL
      </code>
      .
     </p>
     <p>
      <code class="literal">
       LAST_EXECUTED
      </code>
      indicates when the event
          started. As a result, the
      <code class="literal">
       ENDS
      </code>
      column is
          never less than
      <code class="literal">
       LAST_EXECUTED
      </code>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       EVENT_COMMENT
      </code>
     </p>
     <p>
      The text of the comment, if the event has one. If not, this
          value is empty.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       ORIGINATOR
      </code>
     </p>
     <p>
      The server ID of the MySQL server on which the event was
          created; used in replication. This value may be updated by
      <a class="link" href="alter-event.html" title="15.1.3 ALTER EVENT Statement">
       <code class="literal">
        ALTER EVENT
       </code>
      </a>
      to the server ID of
          the server on which that statement occurs, if executed on a
          replication source. The default value is 0.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       CHARACTER_SET_CLIENT
      </code>
     </p>
     <p>
      The session value of the
      <a class="link" href="server-system-variables.html#sysvar_character_set_client">
       <code class="literal">
        character_set_client
       </code>
      </a>
      system
          variable when the event was created.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       COLLATION_CONNECTION
      </code>
     </p>
     <p>
      The session value of the
      <a class="link" href="server-system-variables.html#sysvar_collation_connection">
       <code class="literal">
        collation_connection
       </code>
      </a>
      system
          variable when the event was created.
     </p>
    </li>
    <li class="listitem">
     <p>
      <code class="literal">
       DATABASE_COLLATION
      </code>
     </p>
     <p>
      The collation of the database with which the event is
          associated.
     </p>
    </li>
   </ul>
  </div>
  <h4>
   <a name="idm46045079878688">
   </a>
   Notes
  </h4>
  <div class="itemizedlist">
   <ul class="itemizedlist" style="list-style-type: disc; ">
    <li class="listitem">
     <p>
      <a class="link" href="information-schema-events-table.html" title="28.3.14 The INFORMATION_SCHEMA EVENTS Table">
       <code class="literal">
        EVENTS
       </code>
      </a>
      is a nonstandard
      <code class="literal">
       INFORMATION_SCHEMA
      </code>
      table.
     </p>
    </li>
    <li class="listitem">
     <p>
      Times in the
      <a class="link" href="information-schema-events-table.html" title="28.3.14 The INFORMATION_SCHEMA EVENTS Table">
       <code class="literal">
        EVENTS
       </code>
      </a>
      table are
          displayed using the event time zone, the current session time
          zone, or UTC, as described in
      <a class="xref" href="events-metadata.html" title="27.4.4 Event Metadata">
       Section 27.4.4, “Event Metadata”
      </a>
      .
     </p>
    </li>
    <li class="listitem">
     <p>
      For more information about
      <code class="literal">
       REPLICA_SIDE_DISABLED
      </code>
      and the
      <code class="literal">
       ORIGINATOR
      </code>
      column, see
      <a class="xref" href="replication-features-invoked.html" title="19.5.1.16 Replication of Invoked Features">
       Section 19.5.1.16, “Replication of Invoked Features”
      </a>
      .
     </p>
    </li>
   </ul>
  </div>
  <h4>
   <a name="idm46045079869008">
   </a>
   Example
  </h4>
  <p>
   Suppose that the user
   <code class="literal">
    'jon'@'ghidora'
   </code>
   creates
      an event named
   <code class="literal">
    e_daily
   </code>
   , and then modifies it a
      few minutes later using an
   <a class="link" href="alter-event.html" title="15.1.3 ALTER EVENT Statement">
    <code class="literal">
     ALTER
      EVENT
    </code>
   </a>
   statement, as shown here:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa20922252"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">DELIMITER</span> <span class="token operator">|</span>

<span class="token keyword">CREATE</span> <span class="token keyword">EVENT</span> e_daily
    <span class="token keyword">ON</span> <span class="token keyword">SCHEDULE</span>
      <span class="token keyword">EVERY</span> <span class="token number">1</span> <span class="token keyword">DAY</span>
    <span class="token keyword">COMMENT</span> <span class="token string">'Saves total number of sessions then clears the table each day'</span>
    <span class="token keyword">DO</span>
      <span class="token keyword">BEGIN</span>
        <span class="token keyword">INSERT</span> <span class="token keyword">INTO</span> site_activity<span class="token punctuation">.</span>totals <span class="token punctuation">(</span><span class="token datatype">time</span><span class="token punctuation">,</span> total<span class="token punctuation">)</span>
          <span class="token keyword">SELECT</span> <span class="token keyword">CURRENT_TIMESTAMP</span><span class="token punctuation">,</span> <span class="token function">COUNT</span><span class="token punctuation">(</span><span class="token operator">*</span><span class="token punctuation">)</span>
            <span class="token keyword">FROM</span> site_activity<span class="token punctuation">.</span>sessions<span class="token punctuation">;</span>
        <span class="token keyword">DELETE</span> <span class="token keyword">FROM</span> site_activity<span class="token punctuation">.</span>sessions<span class="token punctuation">;</span>
      <span class="token keyword">END</span> <span class="token operator">|</span>

<span class="token keyword">DELIMITER</span> <span class="token punctuation">;</span>

<span class="token keyword">ALTER</span> <span class="token keyword">EVENT</span> e_daily
    <span class="token keyword">ENABLE</span><span class="token punctuation">;</span></code></pre>
  </div>
  <p>
   (Note that comments can span multiple lines.)
  </p>
  <p>
   This user can then run the following
   <a class="link" href="select.html" title="15.2.13 SELECT Statement">
    <code class="literal">
     SELECT
    </code>
   </a>
   statement, and obtain the
      output shown:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa14438583"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token prompt">mysql&gt;</span> <span class="token keyword">SELECT</span> <span class="token operator">*</span> <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span><span class="token keyword">EVENTS</span>
       <span class="token keyword">WHERE</span> EVENT_NAME <span class="token operator">=</span> <span class="token string">'e_daily'</span>
       <span class="token operator">AND</span> EVENT_SCHEMA <span class="token operator">=</span> <span class="token string">'myschema'</span>\G
<span class="token output"><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span> 1. row <span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span><span class="token punctuation">*</span>
       EVENT_CATALOG<span class="token punctuation">:</span> def
        EVENT_SCHEMA<span class="token punctuation">:</span> myschema
          EVENT_NAME<span class="token punctuation">:</span> e_daily
             DEFINER<span class="token punctuation">:</span> jon@ghidora
           TIME_ZONE<span class="token punctuation">:</span> SYSTEM
          EVENT_BODY<span class="token punctuation">:</span> SQL
    EVENT_DEFINITION<span class="token punctuation">:</span> BEGIN
        INSERT INTO site_activity.totals (time, total)
          SELECT CURRENT_TIMESTAMP, COUNT(<span class="token punctuation">*</span>)
            FROM site_activity.sessions;
        DELETE FROM site_activity.sessions;
      END
          EVENT_TYPE<span class="token punctuation">:</span> RECURRING
          EXECUTE_AT<span class="token punctuation">:</span> NULL
      INTERVAL_VALUE<span class="token punctuation">:</span> 1
      INTERVAL_FIELD<span class="token punctuation">:</span> DAY
            SQL_MODE<span class="token punctuation">:</span> ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,
                      NO_ZERO_IN_DATE,NO_ZERO_DATE,
                      ERROR_FOR_DIVISION_BY_ZERO,
                      NO_ENGINE_SUBSTITUTION
              STARTS<span class="token punctuation">:</span> 2018-08-08 11<span class="token punctuation">:</span>06<span class="token punctuation">:</span>34
                ENDS<span class="token punctuation">:</span> NULL
              STATUS<span class="token punctuation">:</span> ENABLED
       ON_COMPLETION<span class="token punctuation">:</span> NOT PRESERVE
             CREATED<span class="token punctuation">:</span> 2018-08-08 11<span class="token punctuation">:</span>06<span class="token punctuation">:</span>34
        LAST_ALTERED<span class="token punctuation">:</span> 2018-08-08 11<span class="token punctuation">:</span>06<span class="token punctuation">:</span>34
       LAST_EXECUTED<span class="token punctuation">:</span> 2018-08-08 16<span class="token punctuation">:</span>06<span class="token punctuation">:</span>34
       EVENT_COMMENT<span class="token punctuation">:</span> Saves total number of sessions then clears the
                      table each day
          ORIGINATOR<span class="token punctuation">:</span> 1
CHARACTER_SET_CLIENT<span class="token punctuation">:</span> utf8mb4
COLLATION_CONNECTION<span class="token punctuation">:</span> utf8mb4_0900_ai_ci
  DATABASE_COLLATION<span class="token punctuation">:</span> utf8mb4_0900_ai_ci</span></code></pre>
  </div>
  <p>
   Event information is also available from the
   <a class="link" href="show-events.html" title="15.7.7.19 SHOW EVENTS Statement">
    <code class="literal">
     SHOW EVENTS
    </code>
   </a>
   statement. See
   <a class="xref" href="show-events.html" title="15.7.7.19 SHOW EVENTS Statement">
    Section 15.7.7.19, “SHOW EVENTS Statement”
   </a>
   . The following statements are
      equivalent:
  </p>
  <div class="copytoclipboard-wrapper">
   <pre class="programlisting language-sql"><div class="docs-select-all right" id="sa81378684"><div class="copy-help left">Press ⌘+C to copy</div> <div class="right"><button class="clipboard-btn" title="Copy to Clipboard"><span class="icon-clipboard"></span></button></div></div><code class="language-sql"><span class="token keyword">SELECT</span>
    EVENT_SCHEMA<span class="token punctuation">,</span> EVENT_NAME<span class="token punctuation">,</span> <span class="token keyword">DEFINER</span><span class="token punctuation">,</span> TIME_ZONE<span class="token punctuation">,</span> EVENT_TYPE<span class="token punctuation">,</span> EXECUTE_AT<span class="token punctuation">,</span>
    INTERVAL_VALUE<span class="token punctuation">,</span> INTERVAL_FIELD<span class="token punctuation">,</span> <span class="token keyword">STARTS</span><span class="token punctuation">,</span> <span class="token keyword">ENDS</span><span class="token punctuation">,</span> <span class="token keyword">STATUS</span><span class="token punctuation">,</span> ORIGINATOR<span class="token punctuation">,</span>
    CHARACTER_SET_CLIENT<span class="token punctuation">,</span> COLLATION_CONNECTION<span class="token punctuation">,</span> DATABASE_COLLATION
  <span class="token keyword">FROM</span> INFORMATION_SCHEMA<span class="token punctuation">.</span><span class="token keyword">EVENTS</span>
  <span class="token keyword">WHERE</span> table_schema <span class="token operator">=</span> <span class="token string">'<em class="replaceable">db_name</em>'</span>
  <span class="token punctuation">[</span><span class="token operator">AND</span> <span class="token keyword">column_name</span> <span class="token operator">LIKE</span> <span class="token string">'<em class="replaceable">wild</em>'</span><span class="token punctuation">]</span>

<span class="token keyword">SHOW</span> <span class="token keyword">EVENTS</span>
  <span class="token punctuation">[</span><span class="token keyword">FROM</span> <em class="replaceable">db_name</em><span class="token punctuation">]</span>
  <span class="token punctuation">[</span><span class="token operator">LIKE</span> <span class="token string">'<em class="replaceable">wild</em>'</span><span class="token punctuation">]</span></code></pre>
  </div>
 </div>
 <br/>
</div>
