CREATE DATABASE [test] ON (NAME=N'test',FILENAME=N'd:\SQL2kt_Data\test.mdf',SIZE=3mb,MAXSIZE=UNLIMITED,FILEGROWTH=1MB) LOG ON (NAME=N'test_log',FILENAME=N'd:\SQL2kt_Data\test_log.ldf',SIZE=1MB,MAXSIZE=2048MB,FILEGROWTH=10%) GO
create table dbo.test3( [tid] [int] identity(100,1) not null, [name] [varchar](100), constraint [pk_tid] primary key clustered( [tid] desc ) )on [primary]
alter table dbo.test4 add fkt foreign key (tid) references(来自) dbo.test3([tid]) ON UPDATE CASCADE ON DELETE CASCADE
alter table test5 drop constraint(限制) pk_id(别名)
alter table test4 drop constraint fkt(别名)
alter table test5 alter column name int not null
create table dbo.test6( id int not null, vname varchar(20) constraint test6_unique unique nonclustered( vname asc ) )
alter table test6 with nocheck add constraint test6_check check(vname != 'shit')
alter table test6 drop constraint test6_check
create view dbo.view2 as select * from dbo.test6 where dbo.test6.id <= 3;
create table dbo.test3( [tid] [int] identity(100,1) not null, [name] [varchar](100), constraint [pk_tid] primary key clustered( [tid] desc ) )on [primary]
alter table dbo.test4 add constraint fkt foreign key (tid) references dbo.test3([tid]) ON UPDATE CASCADE ON DELETE CASCADE
alter table test5 drop constraint pk_id
alter table test4 drop constraint fkt
alter table test5 alter column name int not null
create table dbo.test6( id int not null, vname varchar(20) constraint test6_unique unique nonclustered( vname asc ) )
alter table test6 with nocheck add constraint test6_check check(vname != 'shit') alter table test3 with nocheck add constraint test3_check2 check(tname != 'shit' and tname != 'fuck' and tname != 'ohyeah')
alter table test6 drop constraint test6_check
create table test4( tid int, pwd varchar(20) default '000000' not null )
alter table stu
add constraint pk_stuno primary key(sno)--sno学号为主键
alter table stu
add constraint uq_stuid unique(sid)--sid为身份证号,每个身份证号是唯一的
alter table stu
add constraint df_sadess default('地址不详') for saddress--saddress为地址,默认值为地址不详
alter table stu
add constraint ck_sage check(sage between 15 and 40)--sage学生年龄,要求其值在到之间
alter table scores
add constraint fk_st foreign key(sno) references stu(sno)
--外键约束,主表stu连接从表scores,关键字段sno
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有