—-添加主键约束(将stuNo作为主键) alter table stuInfo add constraint PK_stuNo primary key (stuNo)
—-添加唯一约束(身份证号唯一,因为每个人的都不一样) alter table stuInfo add constraint UQ_stuID unique(stuID)
—-添加默认约束(如果地址不填 默认为“地址不详”) alter table stuInfo add constraint DF_stuAddress default (‘地址不详’) for stuAddress
—-添加检查约束 (对年龄加以限定 15-40岁之间) alter table stuInfo add constraint CK_stuAge check (stuAge between 15 and 40) alter table stuInfo add constraint CK_stuSex check (stuSex=’男’ or stuSex=’女′)