MySQL trigger if new value is not equal to varchar StackExchange, I'm trying to create a trigger in MySQL (before insert) that gives an error if the new value of "sifra" is not S, P, K, A or Z, but it I'm getting an error even if the said criteria is met.

BEGIN
DECLARE msg VARCHAR(40);
DECLARE sifra VARCHAR(1);
SET sifra = NEW.sifra;
IF (sifra &lt;&gt; 'S' OR sifra &lt;&gt; 'P' OR sifra &lt;&gt; 'K' OR sifra &lt;&gt; 'A' OR sifra &lt;&gt; 'Z' ) THEN
    set msg = "Sifra mora biti S, P, K, A ili Z.";
    SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = msg;
END IF;
END


Any ideas?
Sure you get an error. If for example sifra is S then the sifra &lt;&gt; 'P' will cause the error to appear. Change the OR into AND.