sql 제약 조건 (제약 조건)

853 단어
--------------------------------
---------    ---------------
--------------------------------

--      
alter table stuInfo
 add constraint pk_stuNo primary key (stuNo)
go 
--      
alter table stuInfo
 add constraint uq_stuID unique (stuID)
go
--      
alter table stuInfo
 add constraint df_stuAddress default ('    ') for stuAddress
go
--  check  
alter table stuInfo
 add constraint ck_stuAge check(stuAge between 15 and 40)
go
--      (   stuInfo,   stuMarks)
alter table stuMarks
 add constraint fk_stuNO
 foreign key (stuNo) references stuInfo(stuNo)
go
--    
alter table stuInfo
 drop constraint pk_stuNo
go
alter table stuInfo
 drop constraint uq_stuID
go
alter table stuInfo
 drop constraint df_stuAddress
go
alter table stuInfo
 drop constraint ck_stuAge
go
alter table stuMarks
 drop fk_stuNo
go

좋은 웹페이지 즐겨찾기