- 1、本文档共9页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
假设存在如下的关系模式(exercise 3.11):
Customers (cid, cname, city, discnt)
Agents (aid, aname, city, percent)
Products (pid, pname, city, quantity, price)
Orders (ordno, month, cid, aid, pid, qty, dollars)
请用SQL语言来表示下述数据操作要求。
For each agent taking an order, list the product pid and the total quantity ordered by all customers from that agent.(检索每个经销商销售每一种产品的总数量)
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?(检索符合下述要求的客户的编号:在该客户订购过的所有商品中,每一种商品的平均每笔订单的订购数量均达到或超过300)
Get aid values of agents not taking orders from any customer in Duluth for any product in Dallas.(检索没有为居住在Duluth的任何客户订购过任何商品的经销商的编号)
Get aid values of agents who order at least one common product for each customer who is based in Duluth or Kyoto.(检索为居住在Duluth或Kyoto的所有客户订购过同一种商品的经销商的编号)
Get cid values of customers who make orders only through agent a03 or a05.(检索仅通过a03和a05两个经销商订购过商品的客户编号)
Get pid values of products that are ordered by all customers in Dallas.(检索居住在Dallas的所有客户都订购过的商品编号)
Find agents with the highest percent (percent commission), using the max set function.(检索享有最高佣金比率的经销商的编号)
In the agents table, delete the row with the agent named Gray, print out the resulting table in full, then put Gray back, using the Insert statement.
Use the Update statement to change Gray’s percent to 11. Then change it back.
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.
Write an SQL query to retrieve cid values for customers who place at least one order, but only through agent a04. On the same line with each cid, your query should list the total dollar amount of orders placed.(检索仅仅通过a04号经销商订购过商品的客户编
您可能关注的文档
最近下载
- DB37T4649.2-2023 智能制造第2部分:智能工厂评价体系指南_地方标准.pdf VIP
- 华东理工大学化学反应工程课件-第1章绪论.ppt VIP
- 华东理工大学第9章热量传递与反应器的热稳定性.ppt VIP
- 华东理工大学化学反应工程第4章理想管式反应器.ppt VIP
- 中日关于非物质文化遗产保护的对比研究.docx
- 2024贵州省农村信用社招聘历年考试试题及答案.docx VIP
- 第26课 中华人民共和国成立和向社会主义的过渡 (16).pptx VIP
- 8.1 薪火相传的传统美德(精品课件)--2025学年七年级道德与法治全一册同步精品课堂(统编版五四学制2024).pptx VIP
- DB62_T 3268-2024 人民防空工程平战功能转换技术标准.pdf VIP
- 2025新人教版道德与法治一年级下册《第三单元 幸福一家人》大单元整体教学设计[2022课标].docx
文档评论(0)