Check Constraint

CHECK CONSTRAINT


The CHECK constraint is used to limit the value range that can be placed in a column.
The  CHECK constraint allows only certain values for a column.

How to create a CHECK constraint?

Check constraint can be created in this way:

CREATE TABLE Student(
RollNumber INT NOT NULL,
Name varchar(255), 
Age INT,
CHECK (Age>=18)
);

How to delete a CHECK constraint?

ALTER TABLE Student DROP CHECK Age;