数据库设计(3)

2019-03-27 19:14

Go

4.creat table gys (gysbh char(8) not null constraint PK_dno primary key, gysmc char(8) not null, dz varchar(20) not null, yzbm char(8) not null, dhhm varchar(15) not null, sh varchar(3) not null, yhzh varchar(20) not null, khyh char(8) not null, lxr char(8) not null, beizhu text null ) Go

5.creat table hy (hybh char(8) not null constraint PK_eno primary key, hyname char(6) not null,

sex char(2) check CK_hy sex in (‘男’,‘女’) not null, sfzh varchar(20) not null, xfzje money not null, jf int not null )

6. creat table yg (ygbh char(8) not null constraint PK_fno primary key, ygname char(8) not null,

sex char(2) check CK_yg sex in (‘男’,‘女’) not null, zw char(8) not null, kl varchar(20) not null, qxjb char(4) not null,

10

sfzh varchar(18) not null, ssbmbh char(8) not null,

constraint FK_ano foreign key reference bm(bmbh) ) Go

7.creat table rk (rkbh char(8) not null

constraint PK_gno primary key, xsjg money not null, rkrq datetime not null, spbh char(8) not null

constraint FK_bno foreign key references sp(spbh), ywybh char(8) not null

constraint FK_cno foreign key references yg(ygbh), jldw char(2) not null, rkjg money not null, gysbh char(8) not null

constraint FK_dno foreign key references gsy(gysbh), zje money not null, sl int not null) go

8.creat table zhuxx (xsrp datetime not null, zje money not null,

sfxj char(2) check CK_zhuxx_sfxj in(‘是’,‘否’) not null, sfhy char(2) check CK_zhuxx_sfhy in (‘是’,‘否’) hybh char(8) not null

constraint FK_eno foreign key references hy(hybh), syybh char(8) not null

constraint FK_fno foreign key references yg(ygbh)) go

11

9. creat table zixx (spbh char(8) not null

constraint FK_gno foreign key references sp(spbh), sl int not null, dj money not null, zkbl char(10) not null, je money not null) go

10. creat table kc (kcxxbh char(8) )not null constraint PK_pno primary key, spbh char(8) not null

constraint FK_ino foreign key references sp(spbh), kcl int not null) go

4.2 数据库扩展功能实现

1.CREAT TRIGGER triger_s1 ON rk after insert AS update kc

set kcl =kcl +(select sl from inserted) where spbh=(select spbh from inserted)

2.CREAT TRIGGER triger_kc ON zixx after delete AS update kc

set kcl =kcl -(select sl from deleted) where spbh=(select spbh from deleted)

12


数据库设计(3).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:中国百鬼录2 - 图文

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: