title: MySql Syntax error when creating trigger to insert calculated value
body: <p>This is my first time trying to create a MySql trigger but I'm running into syntax errors that I can't identify. I am trying to have the trigger insert a calculated value when a row is updated. Below is my code, but I keep getting syntax errors when I try to execute it, and I cannot see where the error is. Can someone please look, what am I doing wrong?</p>
  <pre><code>DROP TRIGGER ins_cop_dhw;
  CREATE TRIGGER ins_cop_dhw BEFORE INSERT ON `2017010001_data`
     FOR EACH ROW 
     BEGIN
         IF (NEW.`_007E` = 1 AND `_00A2` &gt; 0) THEN
             SET NEW.`_00B7` = NEW.`_0096` / NEW.`_00A2`;
         END IF;
         IF (NEW.`_007D` = 1 AND `_00A2` &gt; 0) THEN
             SET NEW.`_00B8` = (NEW.`_0096` / NEW.`_00A2`);
         END IF;
     END;
  </code></pre>
  <p>Here is the error I get in MySQL Workbench, but it's not much help. :/</p>
  <pre><code>Error Code: 1064. 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 '' at line 5
  </code></pre>
  <p>MySQL Workbench highlights the end of line 6 as the start of the syntax error.
  <a href="https://i.stack.imgur.com/JCQRV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JCQRV.png" alt="Screenshot of MySql Workbench syntax error highlighting" /></a></p>