mysql trigger not working with if statement CREATE TRIGGER updateNewEmp
AFTER UPDATE ON BasicDetails
FOR EACH ROW  BEGIN
    if(NEW.MiddleName&lt;&gt;OLD.MiddleName) then
      insert into BasicDetails_audit(MiddleName,`State`,Country,Community) 
      VALUES(NEW.MiddleName,NEW.`State`,NEW.Country,NEW.Community)
end if;
end


It throws a syntax error near the END IF statement. Can anyone please help?
You have to change DELIMITER to something else than ;

DELIMITER $$
CREATE TRIGGER updateNewEmp AFTER UPDATE ON BasicDetails FOR EACH ROW  
BEGIN
  IF(NEW.MiddleName&lt;&gt;OLD.MiddleName) 
  THEN
    INSERT INTO BasicDetails_audit(MiddleName,`State`,Country,Community) 
         VALUES (NEW.MiddleName,NEW.`State`,NEW.Country,NEW.Community);
  END IF;
END$$
DELIMITER ;