版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、武 汉 科 技 大 学数据库实验综合设计 二一五 - 二一六 学年第 一 学期学 院: 信息科学与工程学院 专 业: 电子信息工程(DB) 班 级: 1301班 学 号: 201212235049 姓 名: 谢明烨 指导老师: 陈彬 二一五年 12 月 14 日数据库综合实验任务书某商业集团公司的“人员-销售”系统的E-R图如下图所示(其中单箭头表示单联系,双箭头表示多联系):图 “人员-销售”E-R图1. 试根据E-R所示的关系图,在SQLServer数据库系统中建立与之相应的数据表。2. 为建立的数据表中添加必要的测试数据。创建职工表workerCreate table worker(wn
2、o char(9) primary key,wname nchar(20) unique,wsex nchar(2),wbirth smallint,Wgrade char(20),)insert into workervalues(001,周楚,男,1994,3600)insert into workervalues(002,洪云志,男,1995,3950)insert into workervalues(003,李珍,女,1994,4200)insert into workervalues(004,杜姗,女,1994,4000)insert into workervalues(005,范江
3、,男,1993,5000)insert into workervalues(006,王明,男,1992,3000) 创建商店表shop Create table shop(sno char(9) primary key,Sname nchar(20),Splace nchar(20),)insert into shopvalues(1,晨光,武汉)insert into shopvalues(2,淘宝,上海)insert into shopvalues(3,京东,北京)创建聘用表employCreate table employ(Wno char(9) primary key,Sno char
4、(9),Wtime smallint,Wage smallint,Foreign key(sno)references shop(sno),)insert into employvalues(001,1,2016,2000)insert into employvalues(002,2,2017,3000)insert into employvalues(003,3,2017,3500)insert into employvalues(004,2,2018,3000)insert into employvalues(005,3,2017,4000)insert into employvalues
5、(006,1,2016,1800)创建商品表goodsCreate table goods(gno char(9) primary key,gname nchar(20),gprice smallint,Scale int)insert into goodsvalues(1001,钢笔,5,360)insert into goodsvalues(1002,圆珠笔,1,3500)insert into goodsvalues(1003,签字笔,2,9000)insert into goodsvalues(1004,毛笔,5,90)创建销售表gsalecreate table gsale(gno
6、char(9),sno char(9),gsale float,mon int,primary key(gno,sno,mon),foreign key(gno)references goods(gno),foreign key(sno)references shop(sno),)insert into gsale values('1001','1',500,1) insert into gsale values('1002','1',1000,1)insert
7、 into gsale values('1003','1',5000,1) insert into gsale values('1001','2',600,1) insert into gsale values('1002','2',1200,1) insert into gsale values('1003','2
8、',6000,1) insert into gsale values('1004','2',150,1) insert into gsale values('1001','3',700,1) insert into gsale values('1002','3',1300,1) insert into gsale values(
9、9;1003','3',7000,1) insert into gsale values('1004','3',200,1) insert into gsale values('1001','1',600,2) insert into gsale values('1002','1',1200,2)insert into gsale
10、0;values('1003','1',6500,2) insert into gsale values('1001','2',800,2) insert into gsale values('1002','2',1500,2) insert into gsale values('1003','2',8000,2) insert
11、 into gsale values('1004','2',200,2) insert into gsale values('1001','3',600,2) insert into gsale values('1002','3',1800,2) insert into gsale values('1003','3',9
12、000,2) insert into gsale values('1004','3',600,2) 3. 以数据表为基础完成以下查询。A. 查询工号为“001”的员工的基本信息; select*from workerwhere wno='001'B. 查询工号为“001”的员工的工作地点和工资情况;select splace,wagefrom shop,employwhere shop.sno=employ.sno and wno='001'C. 查询商品号为“1001”的商品
13、的基本信息; select* from goodswhere gno='1001'D. 查询商品号为“1001”的商品每个月在商店号为“S001”商店内的销售额;select gsale from gsalewhere gno='1001' and sno='1' and mon=1select gsale from gsalewhere gno='1001' and sno='1' and mon=2E. 查询商品名为“圆珠笔”的商品每个月在每个商店的销售额;select gsale from
14、 gsale,goods where gname='圆珠笔' and goods.gno=gsale.gno and mon=1select gsale from gsale,goods where gname='圆珠笔' and goods.gno=gsale.gno and mon=2F. 查询整个集团“圆珠笔”每个月的销售总额;select sum(gsale)月销售额from gsale,goods whe
15、re goods.gno=gsale.gno and gname='圆珠笔' and mon=1select sum(gsale)月销售额from gsale,goods where goods.gno=gsale.gno and gname='圆珠笔' and mon=2G. 查询每个商品在每个商店的总销售额,结果至少包括商品名,单价,商店名,总销售额等信息;select gname,gprice,sname,sum(gsale)销售总额from goods,shop,g
16、salewhere shop.sno=gsale.sno and goods.gno=gsale.gnogroup by goods.gprice,shop.sname,goods.gnameH. 查询名称为“1号店”的商店人员工资情况,结果至少包括工号,姓名,工资,商店名等信息;select worker.wno,wname,wage,sname from shop,worker,employ where shop.sno=employ.sno and worker.wno=employ.wno an
17、d shop.sno='1'I. 查询每个商店人员工资情况,结果至少包括工号,姓名,工资,商店名等信息;select worker.wno,wname,wage,sname from shop,worker,employwhere shop.sno=employ.sno and worker.wno=employ.wnoJ. 查询每个商店每月总的工资支出总额;select sno,sum(wage)月工资支出总额from employ group by sno K. 所有商店都销售了的商品的商品信息;select gno,gname,gprice,scale from goods where not exists(select *from shop where not exists( select *from gsale where goods.gno=gsale.gno and shop.sno=gsale.sno) L. 至少销售了一号商店所有商品的商店信息select*from sho
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026年高考英语模拟试卷及解析
- 2026年应急管理部所属单位第二批次招聘考试参考题库及答案解析
- 西南证券股份有限公司2026届春季校园招聘考试参考试题及答案解析
- 2026年西安市轻纺建材机电化工国有资产管理公司校园招聘笔试备考题库及答案解析
- 2026年威海荣成市面向村(社区)党组织书记公开招聘事业单位工作人员(3人)考试参考试题及答案解析
- 2026年中国铁路信息科技集团有限公司校园招聘考试备考试题及答案解析
- 2026广西桂林市社会保险事业管理中心招聘公益性岗位人员1人考试备考试题及答案解析
- 2026台州天台县事业单位招聘42人-统考考试参考试题及答案解析
- 2026年武汉地铁集团有限公司校园招聘笔试模拟试题及答案解析
- 2025-2026学年人教版八年级英语下册阅读理解与完形填空测试卷(含答案)
- 铝粉尘安全管理制度
- CJ/T 527-2018道路照明灯杆技术条件
- 肛肠疾病的预防与管理
- 股权投资管理试题及答案
- 帮忙办理调动协议书
- GB/Z 45463-2025热喷涂涂层孔隙率的测定
- 《三维点云:原理、方法与技术》笔记
- 中考英语:近三年中考英语530个高频词非常重要
- 【MOOC】宋词经典-浙江大学 中国大学慕课MOOC答案
- 计算机系统结构曹强习题答案
- 第5课《大自然的语言》课件++2023-2024学年统编版八年级语文下册
评论
0/150
提交评论