thinQmaster Virtual testing partner Adaptive practice exams that find your weak spots and drill them. Every answer explained. From $69
Enroll

thinQmaster

Find your exam

Five questions free, before you decide.

Step 1 · choose a vendor

In one of our camps? Your practice exams come with the tuition — they are on your study page already.

Data & Analytics · Intermediate

Check Constraint

A rule that limits the values a column can accept to those that satisfy a Boolean expression.

Definition

A CHECK constraint is evaluated on INSERT and UPDATE and rejects rows for which the expression is false. It enforces domain integrity inside the database rather than in application code. In standard SQL, a NULL makes the expression unknown, so the row passes.

Example

ALTER TABLE Products ADD CONSTRAINT CK_Price CHECK (Price >= 0);

Exam tip

A CHECK constraint passes rows where the expression evaluates to UNKNOWN, so NULLs get through unless the column is also NOT NULL.

Related terms