Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors

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;

Leave a Comment