/* */
/*
1.not null
①
② : ,name varchar(6) not null,
2.unique
①
②unique primary key
③primary key Unique
④ : primary key , Unique
⑤ :
1.name int unique
2.unique(column_name)
3.CONSTRAINT uc_PersonID UNIQUE (Id_P,LastName)
4.alter table table_name add unique(column_name)
5.ALTER TABLE table_name DROP CONSTRAINT
3.primary key
①
②
③
④ ,
⑤ :
1.StudentID int not null primary key
2.primary key(Students)
3.primary key(StudentID,Email) ID Email
⑥
1.alter table table_name add primary key(column_name)
⑦
1.alter table table_name drop primary key
⑧
1.alter table table_name drop constraint sp_help
4.foreign key
① foreign key primary key
②foreign key
③foreign key ,
④ :
1.foreign key (column_name) references ( ) column_name
2.column_name int foreign key references ( ) column_name
3.alter table table_name
add foreign key ( ) references ( )
4.alter table table_name drop constraint (SQL Server oracle)
5.alter table table_name drop foreign key (Mysql)
5.check
①check
② check ,
③ check ,
④ :
1.StudentID int not null check (StudentID>0) StudentID 0 (SQL Server oracle)
2.StudentID int not null, StudentID 0 (Mysql)
check (StudentID>0)
3.sex varchar(2) not null check(sex=' ' or sex=' ') sex
4.alter table table_name add check( >0) check
5.alter table table_name drop constraint check sp_help table_name
6.default
①default
② ,
③ :
1.name varchar(10) default ' ' name
2.systime date default gatedate() getetime()
3.alter table table_name add set default ' '
4.alter table table_name drop constraint
*/