收藏 分享(赏)

一个典型的数据库设计实例2.doc

上传人:精品资料 文档编号:8547034 上传时间:2019-07-02 格式:DOC 页数:10 大小:1.02MB
下载 相关 举报
一个典型的数据库设计实例2.doc_第1页
第1页 / 共10页
一个典型的数据库设计实例2.doc_第2页
第2页 / 共10页
一个典型的数据库设计实例2.doc_第3页
第3页 / 共10页
一个典型的数据库设计实例2.doc_第4页
第4页 / 共10页
一个典型的数据库设计实例2.doc_第5页
第5页 / 共10页
点击查看更多>>
资源描述

1、Spbh char PSpmc varchar 2t1Sslb char 8Jg money 8sI url 4bmhh char4xfzje money 8kcxxbh chark cl intXsrq t1 tctimc 8Zje Money 6Hybh Char 8$yyhh char Pcreate database gl xt( name os dat,fil ename=D:pos dat.andf,size-5, maxsize-20, fiiegrowth- 1)LOG on( narne=pos log,filenarne=D:pos log.ldf,size-5,creat

2、e table bin(bmbh char(8) not null constraint PK biro primary key, bmmc char(4) not null)gcreate table sp(spbh char(8) riot nullconstraint PK cno primary key,apmc varchar(20) not null ,sslb char(8) not null,st int riot null,jg money not null)4. create table gys(gysbh chart8) not null constraint BK dn

3、o primary gysmc chait8) not null,dz varc h art20) riot null, yzbm char( P) net null, dhhm varchar( 15) not null, sh varchar(3) riot null,yhzh varchaq20) not null,key,khyh char(8) not null , lxr chart 8) not null, bei zhu text null5. create table hy(hybh cha58) riot nut Iconstrai nt PK eno Ji rimory

4、key. hyname char( 6)not rim I ,sex chur(2) check CK hy sex i n ( , V ) n or nul I ,sfzh v arch a520) ncit null,xfzje money not null,j I int not null6. create table yg (ygbh chart 8) not nu I Iconstraint PK fire primary key,ygnamc char(8) not iiul I,sex ch or(2 ) check CK yg sex in ( , k ) not null,z

5、vv cha rfP) not rim I,k I v arch ar(20) riot null,q xjb charl 4) not ml I,sfzh v archa518) not riu II,ss1mbh chai(8) not inn Iconst rai nt FK ano foreign key references bin( bmhh)7. create table rk(rkbh c ha r(8) not nul Iconst rai nt PK quo primary key,xsjg m oiicy not n uI I,rkrq datetimc not nut

6、I, spbh chart 8) not nullconstraint FK bno foreign key references sp(spbh), ywybh charf 8) not nullconstraint FK cue foreign key references yg(ygbh J,j I tl w ch an 2) not null, rkjg money not null, w bh chart 8) not nut Iconstraint FK duo foreign key references gyst gysbh),zje mtiiicy not nuI I,sl

7、iii t not null8. create table zhuxx (xsrq datetime not ml I, zje money not null,constraint FK erm foreign key re fcrcrices fry(hybh), syybh chart 8) not nullconstraint FK fno foreign key re fereia ces yg( ygbh)9. create table zixx( spbh cha9 8) not nullconstraint FK gun foreign key references sp( sp

8、bh),sl i nt not null,d j money not null, zkbl char( 10) not null, je money not ntil l,g*10. create table kc(kcxxbh char(8) not ntl I constraint PK Jin o (Primary key, spbhchar(8) not nut Iconstraint FK ino foreign key re fereiices sp(spbh),kcl i ni not nullI.CREATE TIIlCiGER tri ger sION rkafter insert2. CREATE TRlGCiE R tri ger k cClN zixxafter delete ASupdate k cset k cl=kcl -(sel ect st f mm deletedJ where spbh=(se l ect spbh from deleted)

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 企业管理 > 管理学资料

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报