SQL CHECK

CHECK constraint is used to limit the range of values that can have a column.

You can define multiple CHECK constraints on a table.

Example CHECK in MySQL

CREATE TABLE departments { dep int NOT NULL, department varchar(255), CHECK (dep>0) }

Example CHECK in ORACLE, SQLSERVER y ACCESS:

CREATE TABLE departments { dep int NOT NULL CHECK (dep>0) department varchar(255) }

Example CHECK in ALTER TABLE en MySQL

ALTER TABLE departments ADD CHECK (dep>0)

Example CHECK (with multiple columns) ALTER TABLE in MySQL

ALTER TABLE people ADD CHECK (per>0, age>35)

Example CHECK in ALTER TABLE ORACLE, SQLSERVER y ACCESS

ALTER TABLE departments ADD CONSTRAINT ckdepart CHECK (dep>0)

Example CHECK in ALTER TABLE

ALTER TABLE people ADD CONSTRAINT ckperson CHECK (pers>0, name='HARRY')