title: What can make a trigger to fail and what happens if it fails
body: <p>I've created a trigger (never done it before).<br>
  My goal is:<br>
  WHEN one or more rows are INSERTED into the table 'userlite'<br>
  IF there are rows with 'IdLite' as in the new row inserted in the table 'litedetails'<br>
  THEN add a row to the table 'informations' for each row counted.</p>
  
  <p>The new rows data fields will be:  </p>
  
  <p><strong>IdUser</strong> -> from new row inserted into the table 'userlite'  </p>
  
  <p><strong>IdLite</strong> -> it's the same on new row inserted into the table 'userlite' and into rows selected from the table 'litedetails'  </p>
  
  <p><strong>IdEvent</strong> -> from rows selected  </p>
  
  <p>I used the code below to create the trigger</p>
  
  <pre><code>DELIMITER $$
  CREATE TRIGGER after_newuserlite
  AFTER INSERT ON userlite
  FOR EACH ROW
  BEGIN
  IF (
      (
       SELECT COUNT(*) 
       FROM litedetails
       WHERE IdLite = NEW.IdLite
      ) &gt; 0
     ) THEN
     INSERT INTO informations (IdUser, IdLite, IdEvent)
     SELECT NEW.IdUser AS IdUser, IdLite, IdEvent
     FROM litedetails
     WHERE IdLite = NEW.IdLite;
  END IF;
  END;
  $$
  </code></pre>
  
  <p>I've tested it and all seems to work but I'm worried for my inexperience, so my questions are:<br>
  1) Is there anything that can cause my trigger to fail?<br>
  2) what happens if the trigger fails?<br>
  3) If the trigger fails the query who started the trigger will mantain its effects?</p>