欢迎光临散文网 会员登陆 & 注册

SQL的作业与答案代码1:外键,select * from ,insert into values

2019-11-25 23:56 作者:诗书画唱  | 我要投稿


create table YG(


YG_ID int primary key  identity(1,1),


YG_Name  nvarchar(50) unique not null,

YG_Age int check(YG_Age>=18 and YG_Age<=60),

ZHIWEI_ID int,

YG_gongzi int check (YG_gongzi>2000),

YG_ruzhishijian date default(getdate())

)

create table ZHIWEI(

ZHIWEI_ID   int primary key identity(1, 1),

ZHIWEI_Name nvarchar(50) not null unique

)

alter table YG add foreign key (ZHIWEI_ID) references ZHIWEI (zhiwei_id)

select * from YG

select * from ZHIWEI

insert into zhiwei values('老师')

insert into zhiwei values('班主任')

insert into zhiwei values('校长')


SQL的作业与答案代码1:外键,select * from ,insert into values的评论 (共 条)

分享到微博请遵守国家法律