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

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
  4. 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
  5. 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们
  6. 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
  7. 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
云南大学 软件学 数据库实验4

云南大学软件学院 实验报告 : 姓名: 成绩: 实验4 数据查询 一、实验目的 理解T-SQL语言的使用;熟练掌握数据查询语句;掌握合计函数的使用。 二、实验内容 1、CAP数据库的查询(记录每个查询的SQL语句和查询结果) (1)建立CAP数据库,输入C、A、P、O四张表; 图表 1 创建cap数据库 图表 2创建四个表 图表 3向表中插入数据 图表 4表的内容 (2)完成课后习题[3.2]b、[3.5]、[3.8]a,b、[3.11]b,f,j,l [3.2] (b)Retrieve aid values 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 statement select cid, aid from customers c. agents a where not exists (select * 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 in [3.8](a) 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) [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 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 originally 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 fro

文档评论(0)

elouwn + 关注
实名认证
文档贡献者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档