-- /*check command */ -- The CHECK constraint is used to limit the value range that can be placed in a column. -- If you define a CHECK constraint on a column it will allow only certain values for this column. -- If you define a CHECK constraint on a table it can limit the values in certain columns based on values in other columns in the row. -- The following CHECK constraint ensures that the age of a person must be 18, or older: --------------------------------- create table student(id int,name varchar(255), address varchar(255), age int check (age>=23),salary int); insert into student(id,name,address,age)values(1,"Harsh","Delhi",24); insert into student(id,name,address,age)values(2,"Harsh","Delhi",24); insert into student(id,name,address,age)values(3,"Harsh","Delhi",24); insert into student(id,name,address,age)values(4,"Harsh","Delhi",24); insert into student(id,name,address,age)values(5,"Harsh","Delhi",24); insert into student(id,name,address,age)values(6,"Harsh","Delhi",24); select * from student;
To embed this project on your website, copy the following code and paste it into your website's HTML: