title: mysql trigger on insert not working
body: <p>I am trying to create a rather simple trigger (or so I thought) on insert but it's not working.  Can someone kindly assist me?</p>
  
  <pre><code>CREATE TRIGGER myInsert_Trigger BEFORE UPDATE ON books
  FOR EACH ROW
  BEGIN
      DECLARE ename VARCHAR(255)
      DECLARE bookid int
  
      Select bookid=id, ename=b.name From books B inner join authors A on B.AuthorID=A.id Where B.name=new.name
  
      IF (bookid &gt; 0) THEN
          SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = "Book already exists."
      END IF;
  END;
  </code></pre>
  
  <p>I am new to mySql so please go easy on me :)</p>