title: MySQL: How do I use delimiters in triggers?
body: <p>Someone told me that I need to use a delimiter in my trigger.  I'm looking at the MySQL manual page, and I'm finding it in the example; however, it's not in the generic documentation.</p>
  
  <p>Here's the code I am trying to correct:</p>
  
  <pre><code>CREATE TRIGGER adult BEFORE INSERT OR UPDATE ON table5.column5
  FOR EACH ROW BEGIN
    UPDATE table1 SET column5 = table5.column5 WHERE table5id = table1xtable5.table5id WHERE table1xtable5.table1id = OLD.table1.id$
  END$
  </code></pre>
  
  <p>Honestly, I have no idea how to do this, and the documentation at <a href="http://dev.mysql.com/doc/refman/5.5/en/create-trigger.html" rel="nofollow">http://dev.mysql.com/doc/refman/5.5/en/create-trigger.html</a> seems like a horribly inadequate reference.  For example, when reading about "<code>old</code>" and "<code>new</code>", it references the "<code>subject table</code>"--the table associated with the trigger.  There are two tables associated with this trigger, and I'm actually trying to associate more tables with this trigger....  When looking at the example code, the <code>UPDATE</code> line, which effects table4, only columns within table4 are used (they're adding 1 to the value).  Also, they're using <code>WHERE ~ a3 = NEW.a1</code>.  I don't think that id's work that way.  There shouldn't be a universal ID that works across tables.  They should definitely be using an interdependency table in the example, for applicability.</p>
  
  <p>I actually asked a similar question earlier today about what a good method for doing this would be, but now I'm wondering, simply, if there is a method.  Thanks for reading. :)</p>
  
  <p>Here is an example of a trigger that updates another table, but it doesn't seem to use a delimeter:</p>
  
  <pre><code>CREATE TRIGGER mytrigger BEFORE INSERT ON odp 
  FOR EACH ROW
    UPDATE total_points SET points = points + NEW.points;
  </code></pre>
  
  <p>What isn't explained in this example is how <code>odp</code> and <code>total_points</code> overlap.  How can we be sure that the <code>total_points</code> table's <code>points</code> row is the correct <code>points</code> row?  Which row in the <code>points</code> table would MySQL update?  x//</p>
  
  <p>So, shouldn't there be some way to specify which of the total_points.points rows to update <code>BEFORE INSERT ON odp</code>?</p>