Constraints check(age >= 18)
is not working, New record should not be insert with age value 10. New record should only insert when age value is greater than and equal to 18.
I have created a table with SQL command given below.
create table studentInfo_tbl(
id int not null auto_increment unique,
name varchar(50) not null,
age int(3) not null check(age >= 18),
gender varchar(1) not null default 'm',
address varchar(100),
primary key(id)
);
Insert record command is working and inserting age value 10.
insert into studentinfo_tbl(name, age, gender, address)
values('Ali', 10, 'm', 'New York');