I have used the below query with a constraint to check the values which are inserting to the stu_code column start with 's'.
mysql> CREATE TABLE student_info(
no INT(3) PRIMARY KEY,
stu_code VARCHAR(10),
CHECK (stu_code like 's%'));
Query OK, 0 rows affected (2.68 sec)
but it does not work. When I inserting the values (like below) I can insert values which are not starting with 's'.
mysql> INSERT INTO student_info VALUES (1,'k001');
Query OK, 1 rows affected (0.47 sec)
I am beginer with SQL, Can anyone help me find out what is the issue?