title: MySQL trigger if condition exists
body: <p>I'm trying to write an update trigger that will only update a password when a new password is set in the update statement but I'm having a terrible time trying to nail down the syntax.  This should be a no-brainer but I'm just not finding the solution.</p>
  
  <p>Here's my code:</p>
  
  <pre><code>CREATE TRIGGER upd_user BEFORE UPDATE ON `user`
  FOR EACH ROW BEGIN
    IF (NEW.password &lt;&gt; '') THEN
          SET NEW.password = PASSWORD(NEW.password);
    END IF;
  END;
  </code></pre>
  
  <p>I've tried:</p>
  
  <pre><code>IF (NEW.password &lt;&gt; NULL) THEN
  
  IF (NEW.password) THEN
  
  IF NEW.password &lt;&gt; NULL THEN
  
  IF (NEW.password &gt; 0) THEN
  
  IF (NEW.password != NULL) THEN
  </code></pre>
  
  <p>And I'm sure many other combinations but it's just not working.  Does anyone have any insight?</p>