title: Triggers: football team exercise issues
body: <p>I have some trouble in doing triggers<br/>
  I am doing some exercises for the university, and I prefer to test myself in a real mysql db.
  <br/><br/>The exercise is the following<br/>
  The table schema is:<br/></p>
  
  <pre><code>Result ( &lt;b&gt;Day, Home-Team, Visiting-Team&lt;/b&gt;, Goal-Home, Goal-Visiting )
  Ranking ( &lt;b&gt;Day, Team&lt;/b&gt;, Points )
  </code></pre>
  
  <p><br/>The exercise ask to define a trigger with the next rule<br/>
  When I insert a tuple in the table Result, if Goal-Home > Goal-Visiting I must write two tuples in the table Ranking: one of the winner team and the other for the loser.<br/>
  I clarify it with an example<br/>
  Team A and B, in the day D, had a result of G_A vs G_B, so I must write 2 tuples in Ranking with this rules<br/>
  If G_A > G_B i must write (D, A, 3) and (D, B, 0)<br/>
  If G_A = G_B i must write (D, A, 1) and (D, B, 1)<br/>
  If G_A &lt; G_B i must write (D, A, 0) and (D, B, 3)<br/>
  <br/>
  <br/>
  I have tested this code on my mysql db, but it doesn't work (i made some attempts)<br/>
  <br/></p>
  
  <pre><code>DELIMITER //
  CREATE TRIGGER insertRankValues 
  AFTER INSERT ON Result
  FOR EACH ROW
  BEGIN
  IF NEW.Goal-Home &gt; NEW.Goal-Visiting 
  INSERT INTO Ranking VALUES ( NEW.Day, NEW.Home-Team, 3);
  INSERT INTO Ranking VALUES ( NEW.Day, NEW.Visiting-Team, 0);
  END IF;
  IF NEW.Goal-Home &lt; NEW.Goal-Visiting 
  INSERT INTO Ranking VALUES ( NEW.Day, NEW.Home-Team, 0);
  INSERT INTO Ranking VALUES ( NEW.Day, NEW.Visiting-Team, 3);
  END IF;
  IF NEW.Goal-Home = NEW.Goal-Visiting 
  INSERT INTO Ranking VALUES ( NEW.Day, NEW.Home-Team, 1);
  INSERT INTO Ranking VALUES ( NEW.Day, NEW.Visiting-Team, 1);
  END IF;
  END; //
  </code></pre>
  
  <p><br/>
  Do you have some suggestions?Why it doesn't work?<br/>
  Thank you in advance for your patience!!!<br/></p>