MySQL 5.1 Reference Manual  /  ...  /  SHOW CREATE TRIGGER Syntax

13.7.5.13 SHOW CREATE TRIGGER Syntax

SHOW CREATE TRIGGER trigger_name

This statement shows the CREATE TRIGGER statement that creates the named trigger. This statement requires the TRIGGER privilege for the table associated with the trigger.

mysql> SHOW CREATE TRIGGER ins_sum\G
*************************** 1. row ***************************
               Trigger: ins_sum
              sql_mode: 
SQL Original Statement: CREATE DEFINER=`me`@`localhost` TRIGGER ins_sum
                        BEFORE INSERT ON account
                        FOR EACH ROW SET @sum = @sum + NEW.amount
  character_set_client: latin1
  collation_connection: latin1_swedish_ci
    Database Collation: latin1_swedish_ci

SHOW CREATE TRIGGER output has the following columns:

  • Trigger: The trigger name.

  • sql_mode: The SQL mode in effect when the trigger executes.

  • SQL Original Statement: The CREATE TRIGGER statement that defines the trigger.

  • character_set_client: The session value of the character_set_client system variable when the trigger was created.

  • collation_connection: The session value of the collation_connection system variable when the trigger was created.

  • Database Collation: The collation of the database with which the trigger is associated.

SHOW CREATE TRIGGER output has the following columns:

  • Trigger: The trigger name.

  • sql_mode: The SQL mode in effect when the trigger executes.

  • SQL Original Statement: The statement to be executed when the trigger activates.

  • character_set_client: The session value of the character_set_client system variable when the trigger was created.

  • collation_connection: The session value of the collation_connection system variable when the trigger was created.

  • Database Collation: The collation of the database with which the trigger is associated.

SHOW CREATE TRIGGER was added in MySQL 5.1.21.

You can also obtain information about trigger objects from INFORMATION_SCHEMA, which contains a TRIGGERS table. See Section 20.23, “The INFORMATION_SCHEMA TRIGGERS Table”.


User Comments
Sign Up Login You must be logged in to post a comment.