What is CHECK Constraint?

What is CHECK Constraint?

View Answers

November 19, 2010 at 1:02 PM

Hi,

The CHECK constraint is used to limit the value range that can be placed in a column.The SQL CHECK constraint ensures that all values in a column satisfy certain conditions,If you define a CHECK constraint on a single column it allows 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.

CREATE TABLE newitems (
   newitem_num INTEGER CHECK (newitem_num > 10),
   manucode CHAR(3) NOT NULL,
   promotype INTEGER,
   descrip CHAR(20))

thanks.









Related Tutorials/Questions & Answers:
Advertisements