ALTER TABLE Student --主键约束
ADD CONSTRAINT PK_StuNo PRIMARY KEY (StudentNo)
ALTER TABLE Student --唯一约束(身份证号唯一)
ADD CONSTRAINT UQ_stuID UNIQUE (IdentityCard)
ALTER TABLE Student --默认约束(地址不详)
ADD CONSTRAINT DF_stuAddress DEFAULT ('地址不详') FOR Address
ALTER TABLE Student --检查约束(出生日期是自1980年1月1日以后)
ADD CONSTRAINT CK_stuBornDate CHECK(BornDate>='1980-1-1')
ALTER TABLE Student --添加外键约束
ADD CONSTRAINT FK_Grade
FOREIGN KEY(GradeID) REFERENCES Grade(GradeID)
go