ImageVerifierCode 换一换
格式:DOCX , 页数:14 ,大小:271.76KB ,
资源ID:10725020      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/10725020.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(云南大学软件学院数据库实验4.docx)为本站会员(b****7)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

云南大学软件学院数据库实验4.docx

1、云南大学软件学院数据库实验4云南大学软件学院 实验报告课程: 数据库原理与实用技术实验 学期: 2012-2013学年 第 二 学期 任课教师: 专业: 学号: 姓名: 成绩: 实验4 数据查询一、实验目的理解T-SQL语言的使用;熟练掌握数据查询语句;掌握合计函数的使用。二、实验内容1、CAP数据库的查询(记录每个查询的SQL语句和查询结果)(1)建立CAP数据库,输入C、A、P、O四张表;图表 1 创建cap数据库图表 2创建四个表图表 3向表中插入数据图表 4表的内容(2)完成课后习题3.2b、3.5、3.8a,b、3.11b,f,j,l 3.2 (b)Retrieve aid valu

2、es of agents who receive the maximum percent commission.图表 5最高佣金百分率3.5 Consider the problem to find all (cid, aid) pairs where the customer does not place an order through the agent. This can be accomplished with the Select statementselect cid, aid from customers c. agents a where not exists (select

3、 * from orders x where x.cid = c.cid and x.aid =a.aid) ;Is it possible to achieve this result using the NOT IN predicate in place of the NOT EXISTS predicate with a single Subquery? With more than one Subquery? Explain your answer and demonstrate any equivalent form by execution.图表 6 3.5 not in3.8(a

4、) Write a Select statement with no WHERE clause to retrieve all customer cids and the maximum money each spends on any product. Label the columns of the resulting table: eid, MAXSPENT.图表 7 3.8(b) Write a query to retrieve the AVERAGE value (over all customers) of the MAXSPENT of query (a)图表 8 3.8(b)

5、3.11 (b) We say that a customer x orders a product y in an average quantity A if A is avg(qty) for all orders rows with cid = x and pid = y. Is it possible in a single SQL statement to retrieve cid values of customers who order all the products that they receive in average quantities (by product) of

6、 at least 300?图表 9 3.11 (b)(f) Get pid values of products that are ordered by all customers in Dallas.图表 10 3.11 (f)(j) Use a single Update statement to raise the prices of all products warehoused in Duluth or Dallas by 10%. Then restore the original values by rerunning the procedure that you origin

7、ally used to create and load the products table.图表 11 3.11 (j)(l) Write an SQL query to get aid and percent values of agents who take orders from all customers who live in Duluth. The aid values should be reported in order by decreasing percent. (Note that if percent is not retrieved in the select l

8、ist, we cannot order by these values.)图表 12 3.11 (i)2、Employee数据库的查询(记录每个查询的SQL语句和查询结果)(1)向表中插入数据。use Employee1INSERT INTO department values(001, 营销部);INSERT INTO department values(002, 财务部);INSERT INTO department values(003, 人事部);INSERT INTO department values(004, 采购部);select * from departmentINSER

9、T INTO person values(000001,田林,男,1982/4/7,初级,001);INSERT INTO person values(000002,郭达,男,1953/2/14,高级,001);INSERT INTO person values(000003,王林,女,1984/8/25,初级,002);INSERT INTO person values(000004,王辉,男,1984/5/11,初级,002);INSERT INTO person values(000005,罗大右,男,1968/12/10,高级,002);INSERT INTO person value

10、s(000006,蔡琴,女,1978/4/20,中级,003);INSERT INTO person values(000007, 李艳, 女,1960/5/14, 高级,001);INSERT INTO person values(000008, 刘德华, 男,1971/2/19, 高级,003);INSERT INTO person values(000009, 黎明, 男,1973/10/9, 中级,002);select * from personINSERT INTO salary values(000001, 2100,500,1);INSERT INTO salary value

11、s(000002, 3000,600,1);INSERT INTO salary values(000003, 2800,450,1);INSERT INTO salary values(000004, 2500,340,1);INSERT INTO salary values(000005, 3200,490,1);INSERT INTO salary values(000006, 2700,600,1);INSERT INTO salary values(000007, 4000,200,1);INSERT INTO salary values(000008, 2800,350,1);IN

12、SERT INTO salary values(000009, 2760,440,1);INSERT INTO salary values(000001, 2400,600,2);INSERT INTO salary values(000002, 2800,400,2);INSERT INTO salary values(000003, 2860,350,2);INSERT INTO salary values(000004, 2540,320,2);INSERT INTO salary values(000005, 3200,480,2);INSERT INTO salary values(

13、000006, 2700,300,2);INSERT INTO salary values(000007, 4000,250,2);INSERT INTO salary values(000008, 2800,300,2);INSERT INTO salary values(000009, 2760,480,2);INSERT INTO salary values(000001, 2200,500,3);INSERT INTO salary values(000002, 3100,400,3);INSERT INTO salary values(000003, 2800,650,3);INSE

14、RT INTO salary values(000004, 2500,540,3);INSERT INTO salary values(000005, 3200,400,3);INSERT INTO salary values(000006, 2700,660,3);INSERT INTO salary values(000007, 4100,400,3);INSERT INTO salary values(000008, 2000,330,3);INSERT INTO salary values(000009, 2760,420,3);select * from salary图表 13 表的

15、内容图表 14 修改Fact的值(2)将职工编号为000006的员工3月份基本工资增加为3000,奖金增加到800。图表 15 更新表的内容(3)员工000009已经离开公司,将该员工的数据删除图表 16 删除表中数据(4)简单条件查询查询person表中所有不重复的职称。图表 17 查询不重复的职称查询具有高级职称的女员工信息图表 18 查询内容查询职工姓名为黎明的员工数据图表 19查询表的内容查询各部门的实发工资总数 (5)复杂条件查询查询平均工资高于3000的部门名和对应的平均工资。图表 20 表的统计查询1月份实发工资比平均实发工资高的员工姓名和实发工资额。图表 21查询表的内容查询2月份实发工资比一月高的员工姓名。图表 22查询表的内容利用sql语句将1,2,3月累积的员工的实发工资按降序排序图表 23 工资降序排列 (注:可编辑下载,若有不当之处,请指正,谢谢!)

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1