重量需大于0,并且小于等于100
WEIGHT NUMERIC(9,2) CHECK(WEIGHT>0 AND WEIGHT<=100
性别取‘男’或者‘女’
SSEX CHAR(2) CHECK(SSEX='male' OR SSEX='female')
年龄取15-45
SAGE SMALLINT CHECK(SAGE>=15 AND SAGE<=45)
学分大于0
SEMSTER SMALLINT CHECK(SEMSTER>0)
ALTER TABLE Persons ADD CHECK (Id_P>0)
如果需要命名约束
ALTER TABLE Persons ADD CONSTRAINT chk_Person CHECK (Id_P>0 AND City='Sandnes')
删除有名约束
ALTER TABLE Persons DROP CHECK chk_Person