--非空约束 not null
--主键约束(PK) primary key constraint 唯一且不为空
alter table Student
add constraint PK_Student primary key(sId)
--唯一约束 (UQ)unique constraint 唯一,允许为空,但只能出现一次
alter table Student
add constraint UQ_Student_sNo unique(sNo)
--默认约束 (DF)default constraint 默认值
alter table Student
add constraint DF_Student_sSex default('男') for sSex
--检查约束 (CK)check constraint 范围以及格式限制
alter table Student
add constraint CK_Student_sSex check (sSex='男' or sSex='女')
alter table Student
add constraint CK_Student_sAge check (sAge >=20)
alter table Student
add constraint CK_Student_date check (sIntime>sBirthday)
--外键约束 (FK)foreign key constraint 表关系
alter table Student
drop constraint FK_Student_sClassId
alter table Student
add constraint FK_Student_sClassId foreign key (sClassId) references Class(cId)
--删除约束
alter table Student
drop constraint CK_Student_sAge
··