mysql check constraint not working
MySQL only parses the text of a CHECK constraint, it does not actually enforce them.

From the documentation:


  The CHECK clause is parsed but ignored by all storage engines.


A workaround is to use a trigger:

DELIMITER //
create trigger student_info_bitrig before insert on student_info
for each row
begin
    declare errormessage varchar(100);
    if new.stu_code not like 's%' then
        set errormessage = concat('Error - Value not allowed: ', new.stu_code);
        signal sqlstate '45000' set message_text = errormessage;
    end if;
end
//

DELIMITER ;


Test:

mysql&gt; INSERT INTO student_info VALUES (1,'k001');
ERROR 1644 (45000): Error - Value not allowed: k001
mysql&gt;