title: create trigger not working in mysql
body: <p>i am trying to write a trigger which validates insert statements before inserting in the table</p>
  
  <p>table structure:</p>
  
  <p><a href="https://i.stack.imgur.com/siMbj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/siMbj.png" alt="enter image description here"></a></p>
  
  <p>This is the code that i wrote</p>
  
  <pre><code>DELIMITER
      $$
  CREATE TRIGGER check_date_format
  INSERT BEFORE ON
  job_histry FOR EACH ROW
  BEGIN 
  SET @bool=NEW.end_date LIKE '--/--/----';
  IF @bool THEN
      INSERT
  INTO
      job_histry
  VALUES(
      NULL,
      NEW.start_date,
      NEW.end_date,
      NEW.job_id,
      NEW.department_id
  ) ;
      END IF ;
  END
  $$
  </code></pre>
  
  <p>This is the error that i received:</p>
  
  <blockquote>
    <p><strong>#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'INSERT BEFORE ON job_histry FOR EACH ROW BEGIN SET @bool=NEW.end_date LIKE '' at line 2</strong></p>
  </blockquote>
  
  <p>why is this happening? </p>
  
  <p>I am using localhost xampp server.</p>