title: MySQL trigger: print a warning message when an inserted entry is greater than a value
body: <p>I have create a table as below:</p>
  
  <pre><code>mysql&gt; create table testa (a int, b int, c real);
  Query OK, 0 rows affected (0.14 sec)
  </code></pre>
  
  <p>But when I want to implement a trigger like this, I face some syntax errors:</p>
  
  <pre><code>mysql&gt; create trigger testa_trig  
         before insert ON testa 
         FOR EACH ROW 
         WHEN (NEW.c &gt; 100) 
         BEGIN 
           Print "Warning: c &gt; 100!"
         END;
  ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHEN (NEW.c &gt; 100) 
  BEGIN
  Print "Warning: c &gt; 100!"
  END' at line 4
  </code></pre>
  
  <p>I have checked the documentation at <a href="http://dev.mysql.com/doc/refman/5.0/en/trigger-syntax.html" rel="noreferrer">http://dev.mysql.com/doc/refman/5.0/en/trigger-syntax.html</a> but can't figure out the problem!</p>
  
  <p>My MySQL version:</p>
  
  <pre><code>Server version: 5.5.38-0ubuntu0.12.04.1 (Ubuntu)
  </code></pre>
  
  <p>Based on the comments below, I tried the following cases, but also crashed:</p>
  
  <pre><code>mysql&gt; create trigger testa_trig before insert on testa for each row 
         if (NEW.c &gt; 100) begin insert into testb set bc=NEW.c end;
  ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'begin insert into testb set bc=NEW.c end' at line 1
  </code></pre>