CREATE VIEW Statement Statement” . Some statements are not permitted in triggers; see Section 25.8, “Restrictions on Stored Programs” . Within the trigger body, you can refer to columns in the subject table (the table associated with the trigger) by using the aliases  OLD  and  NEW .  OLD. col_name  refers to a column of an existing row before it is updated or deleted.  NEW. col_name  refers to the column of a new row to be inserted or an existing row after it is updated. Triggers cannot use  NEW. col_name  or use  OLD. col_name  to refer to generated columns. For information about generated columns, see Section 13.1.20.8, “CREATE TABLE and Generated Columns” . MySQL stores the  sql_mode  system variable setting in effect when a trigger is created, and always executes the trigger body with this setting in force,  regardless of the current server SQL mode when the trigger begins executing . The  DEFINER  clause specifies the MySQL account to be used when checking access privileges at trigger activation time. If the  DEFINER  clause is present, the  user  value should be a MySQL account specified as  ’ user_name ’@’ host_name ’ ,  CURRENT_USER , or  CURRENT_USER() . The permitted  user  values depend on the privileges you hold, as discussed in Section 25.6, “Stored Object Access Control” . Also see that section for additional information about trigger security. If the  DEFINER  clause is omitted, the default definer is the user who executes the  CREATE TRIGGER statement. This is the same as specifying  DEFINER = CURRENT_USER  explicitly. MySQL takes the  DEFINER  user into account when checking trigger privileges as follows: Within a trigger body, the  CURRENT_USER  function returns the account used to check privileges at trigger activation time. This is the  DEFINER  user, not the user whose actions caused the trigger to be activated. For information about user auditing within triggers, see Section 6.2.22, “SQL-Based Account Activity Auditing” . If you use  LOCK TABLES  to lock a table that has triggers, the tables used within the trigger are also locked, as described in LOCK TABLES and Triggers. For additional discussion of trigger use, see Section 25.3.1, “Trigger Syntax and Examples” . •At  CREATE TRIGGER  time, the user who issues the statement must have the  TRIGGER  privilege. •At trigger activation time, privileges are checked against the  DEFINER  user. This user must have these privileges: •The  TRIGGER  privilege for the subject table. •The  SELECT  privilege for the subject table if references to table columns occur using  OLD. col_name or  NEW. col_name  in the trigger body. •The  UPDATE  privilege for the subject table if table columns are targets of  SET NEW. col_name  = value  assignments in the trigger body. •Whatever other privileges normally are required for the statements executed by the trigger. 13.1.23 CREATE VIEW Statement CREATE [OR REPLACE] [ALGORITHM = {UNDEFINED | MERGE | TEMPTABLE}] [DEFINER =  user ] [SQL SECURITY { DEFINER | INVOKER }] VIEW  view_name  [( column_list )] 2606