还剩16页未读,继续阅读
本资源只提供10页预览,全部文档请下载后查看!喜欢就下载吧,查找使用更方便
文本内容:
供给链管理系统的数据库设计系统需求分析
1.a.通过建立供给链的数据库建立以方便各种信息的查询与管理工作b.系统简述本系统包括六个实体生产商;运输商;商场;仓库;商品;顾客包括四个关系转为四个表运输;生产;销售;储存c.对该数据库进行如下数据处理I查询
①查询其商场所有的信息,输入商场编号,输出信息
②查询某种商品的生产、运输、商场的信息,输入商品的编号,输出生产商、运输时间、运输商、销售商场
③商场想查询某一类的商品储存仓库信息,输入商品编号,输出仓库编号地址、储存时间
④查询商品列表里的各类商品个数,并按类型分组II.插入
①在商品表中插入新商品
②插入新的销售记录
③插入新的运输记录in.修改
①修改旧商品的价格
②修改运输的记录系统概念模型图)二.(E-R
①实体的关系图:
②实体的属性图:Insert into运输values‘0001’
2009.
09.or‘北京’Insert into运输values0002运二
2010.or北京20OL,、,—Insert into运输values
00032010.
02.02天津30足二Insert into运输values0004运四
2009.
09.or天津4rInsert into运输values‘0005运五
1997.
01.02上海20’Insert into商场values‘0001商场一,天津
2009.
01.or’大Insert into商场values0002商场二北京
2010.oi.or小Insert into商场values0003商场三上海
2010.
02.02小Insert into商场values‘0004商场四长沙
2010.
03.or大’Insert into仓库values‘0001上海1000’Insert into仓库values‘0002天津500’Insert into仓库values0003天津1000’Insert into仓库values‘0004北京2000’Insert into商品values^ooo食品rInsert into商品values0002美年达4J食品Insert into商品values0003可口可乐,4,食品Insert into商品values0004汉堡,10,食品Insert into商品values0005Audi A5‘J300000,汽车,Insert into商品values0001Audi A6,400000,汽车,Insert into商品values0002Audi A4‘J200000,汽车,Insert into商品values0003ADIDAS运动鞋r鞋帽Insert into商品values0004ADIDAS运动鞋2鞋帽Insert into商品values‘0005ADIDAS运动鞋3鞋帽’Insert into顾客values‘3009201001赵一20女’Insert into顾客values3009202001钱二19男Insert into顾客values’3009203001李三2T女’Insert into顾客values3009204001王五22男Insert into生产values0001ooor
00022009.
09.05Insert into生产values
0002000300022009.
09.or Insert into生产values‘00030003ooor
2010.07,03’Insert into生产values‘
0004000400052010.
07.04’Insert into生产values
0005000500042010.07,05Insert into生产values
0006000600042010.
07.06Insert into生产values
0007000700032010.
07.07Insert into生产values‘
0008000800032010.
07.08’Insert into生产values
0009000900032010.
07.09Insert into生产values
0010001000032010.
07.10,Insert into运输values T,ooor0002ooor
2009.
09.05/000r Insert into运输values,20004,0002,0002,
2009.
09.01,0002values3/0003,0001,0004,
2010.07,03,0004Insert into运输Insert into运输values,4,
0003000500032010.
07.040005values5,00050004’
00032010.07,050002Insert into运输values6,
0006000400022010.
07.060005Insert into运输Insert into运输0001,
2010.
07.07,0003values’70003,0003Insert into运输values000200030002,
2010.
07.080002Insert into运输values9,000600030001,
2010.
07.09ooorInsert into运输values‘100005,0003,
00022010.
07.io,ooorInsert into销售Insert into销售女,Insert into销售女,Insert into销售女Insert into销售女,Insert into销售女,Insert into销售女,Insert into储存values0001,0003,0001,
2010.IL0V0001Insert into储存values(00020002,0001,
2010.
11.05,0003Insert into储存values(0003,00010002,
2010.
11.10,0004create nonclusteredindexidx生产商on生产商(生产商编号)create nonclusteredindexidx运输on运输(生产商编号)create nonclusteredindexidx运输2on运输(商场编号)create nonclusteredindexidx商场on商场(商场编号)create nonclusteredindexidx储存on储存(仓库编号)create nonclusteredindexidx仓库on仓库仓库编号create view供给链图asselect生产商名称,运输商名称,商场名称,商品.商品编号,运输时间,商品类型,生产时间from生产商join运输on生产商.生产商编号二运输.生产商编号join运输商on运输商.运输商编号二运输.运输商编号join商场on商场.商场编号二运输.商场编号join商品on商品.商品编号二运输.商品编号join生产on生产.商品编号二商品.商品编号create view存储图asselect仓库.仓库编号,商品编号,所属商场from商场join存储on商场.商场编号二存储.所属商场join仓库on仓库.仓库编号二存储.仓库编号
4.创立存储过程
①查询create procedure商场信息@shopID char10asbeginprintlist ofthe informationof thisshop,select商场名称,商场地址,商场规模,商场注册年份from商场where商场编号=@$八^1口endcreate procedure供给链信息@goodID char20asbeginprintlist ofthe informationof thisgood sprovideselect生产商名称,运输商名称,商场名称from供给链图where商品编号二@goodIDendcreate procedure储存信息©goodID char20asbeginprintlist ofthe storageselect仓库编号,商品编号,所属商场from存储图where商品编号=@8011口endcreate procedure分类信息@goodID char20asbeginselect商品类型,count*from商品group by商品类型end
②插入create procedure插入商品信息@goodID char20,©goodname char10,©goodpricemoney,©goodtype char20asinsert into商品values@goodID,©goodname,©goodprice,@goodtypecreate procedure插入销售记录©personid char20,@shopnameIDchar20,@goodid char20,@sellID char20,@selltime datetimeasinsertinto销售values@personid,@shopnameID,@goodid,@sellID,©selltime
③修改Create procedure修改商品价格©goodprice money,©goodid char20AsUpdate商品Set商品价格=@8001口1瓦6Where商品编号=@800111Create procedure修改运输记录@oldtid char20,@tid char20,@shopid char20,@tpid char20,@goodid char20,@time datetime,@fid char20As update运输Set运输编号二@tid,运输商编号=@tpid,生产商编号二@fid,商品编号二随oodid,运输时间商品编号=@$卜^11Where运输编号=@1151
③关系属性图:
三、关系模式(加下划线的是主键)
①生产商关系(生产商编号,生产商名称,生产商地址,生产商类型,生产商注册年份)
②运输商关系(运输商编号,运输商名称,运输商注册年份,运输商地址,运输商车辆数)
③商场关系(商场编号,商场名称,商场注册年份,商场地址,商场规模)
④顾客关系(顾客身份证号,顾客姓名,顾客年龄,顾客性别)
⑤仓库关系(仓库编号,仓库地址,仓库存储价格)
⑥商品关系(商品编号,商品名称,商品价格,商品类型)
⑦生产关系(生产编号,商品编号,生产商编号,生产时间)
⑧运输关系(运输编号,商场编号,生产商编号,商品编号,运输时间,运输商编号)
⑨销售关系(顾客身份证号,商场编号,商品编号,销售编号,销售时间)⑩储存关系(储存编号,商品编号,仓库编号,储存时间,所属商场)
四、物理设计
①生产商字段名类型特殊属性生产商编号char20主键not null生产商名称char20not null生产商地址char20char20生产商类型datetime not null生产商注册年份
②运输商:字段名类型特殊属性运输商编号char20主键not null运输商名称char10运输商注册年份datetime not null运输商地址char20not null运输商车辆数not nullint
③商场:字段名类型特殊属性char20商场编号主键商场名称char10not null商场注册年份datetime not nullnot null商场地址char20char20not null商场规模
④顾客:字段名类型特殊属性顾客身份证号char20主键char10not null顾客姓名char2not null顾客性别顾客年龄int not null
⑤仓库字段名类型特殊属性仓库编号char20主键仓库地址char10not nullnot null仓库存储价格money
⑥商品:字段名类型特殊属性商品编号char20主键商品名称char10not null商品类型char20not nullnot null商品价格money
⑦生产:字段名类型特殊属性生产编号char20主键生产商编号char10外键商品编号char20not null生产时间datetime not null
⑧运输:字段名类型特殊属性运输编号char20主键运输商编号char10外键商场编号Char20nut null商品编号char20not nullchar20not null生产商编号运输时间datetime
⑨销售:字段名类型特殊属性销售编号Char10主键not null商场编号char10销售时间char20not null商品编号char20外键not null顾客身份证号char20⑩储存:字段名类型特殊属性储存编号char20主键仓库编号char10外键not null商品编号Char20char20not null储存时间所属商场char20not null
五、系统实现数据库的建立用企业管理器,根本表用T-SQL语言数据库名PM-System建立数据库的「SQL语句如下Create databasePM-SystemOnname=pm_system_data,filename=E:\数据库\sm_system_data.mdfJ Logon name=pm_system_log,filename=E:\数据库\sm_system_data.Idf建立表的SQL语句如下Use PM_SystemCreate table生产商生产商编号char20primary key,生产商名称char20not null,生产商地址char20not null,生产商类型char20,生产商注册年份datetime not nullCreate table运输商运输商编号char20primary key,运输商名称char10not null,运输商注册年份datetime not null,运输商地址char20not null,运输商车辆数int not nullCreate table商场商场编号char20primary key,商场名称char10not null,商场地址char20not null,商场注册年份datetime not null,商场规模char20not nullCreate table顾客顾客身份证号char20primary key,顾客姓名char10not null,顾客年龄int,顾客性别char2not nullCreate table仓库仓库编号char20primary key,仓库地址char10not null,仓库存储价格money not nullCreate table商品商品编号char20primary key,商品名称char10not null,商品价格money not null,商品类型char20notnullCreate table生产生产编号char20primary key,商品编号char20notnull,生产商编号char20notnullreferences生产商生产商编号,生产时间datetime notnullCreatetable运输运输编号char20primary key,商场编号Char20nut null,生产商编号char20notnull,商品编号char20notnull,运输时间datetime,运输商编号char20notnullreferences运输商运输商编号Createtable销售顾客身份证号char20notnull,商场编号char20notnull,商品编号char20notnull references商品商品编号,销售编号Char10primary key,销售时间char20notnullCreatetable存储储存编号char20pimary key,商品编号Char20notnull,仓库编号char20notnullreferences仓库仓库编号,储存时间char20notnull,所属商场char20notnull输入数据:Insertinto生产商values0001’品可口可乐,‘北京,食,
2010.oi.or Insertinto生产商values0002‘百事可乐,‘天津‘,食品,
2010.
01.02Insertinto生产商values0003帽,,ADIDAS运动鞋,‘北京,鞋
2010.
02.or Insertinto生产商values0004车,Audi A4,‘北京,’汽J
2010.
03.or Insertinto生产商values‘0005’‘麦当劳‘,‘北京‘,食品,
2010.
04.or。
个人认证
优秀文档
获得点赞 0