




已阅读5页,还剩4页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
II. III. The key fields are underlined, and the domain of each field is listed after the field name. Therefore sid is the key for Suppliers, pid is the key for Parts, and sid and pid together form the key for Catalog. The Catalog relation lists the prices charged for parts by Suppliers. Write the following queries in relational algebra. 1. Find the names of suppliers who supply some red part. 2. Find the sids of suppliers who supply some red or green part. 3. Find the sids of suppliers who supply some red part or are at 221 Packer Street. 4. Find the sids of suppliers who supply some red part and some green part. 5. Find the sids of suppliers who supply every part. 6. Find the sids of suppliers who supply every red part. 7. Find the sids of suppliers who supply every red or green part. 8. Find the sids of suppliers who supply every red part or supply every green part. 9. Find pairs of sids such that the supplier with the first sid charges more for some part than the supplier with the second sid. 10. Find the pids of parts supplied by at least two different suppliers. 11. Find the pids of the most expensive parts supplied by suppliers named Yosemite Sham. 12. Find the pids of parts supplied by every supplier at less than $200. (If any supplier either does not supply the part or charges more than $200 for it, the part is not selected.) IV Consider the following schema: Suppliers(sid: integer, sname: string, address: string) Parts(pid: integer, pname: string, color: string) Catalog(sid: integer, pid: integer, cost: real) The Catalog relation lists the prices charged for parts by Suppliers. Write the following queries in SQL: 1. Find the pnames of parts for which there is some supplier. 2. Find the snames of suppliers who supply every part. 3. Find the snames of suppliers who supply every red part. 4. Find the pnames of parts supplied by Acme Widget Suppliers and no one else. 5. Find the sids of suppliers who charge more for some part than the average cost of that part (averaged over all the suppliers who supply that part). 6. For each part, find the sname of the supplier who charges the most for that part. 7. Find the sids of suppliers who supply only red parts. 8. Find the sids of suppliers who supply a red part and a green part. 9. Find the sids of suppliers who supply a red part or a green part. 10. For every supplier that only supplies green parts, print the name of the supplier and the total number of parts that she supplies. 11. For every supplier that supplies a green part and a red part, print the name and price of the most expensive part that she supplies. V. Consider the B+ tree index of order d = 2 shown in the following figure. 1. Show the tree that would result from inserting a data entry with key 9 into this tree. 2. Show the B+ tree that would result from inserting a data entry with key 3 into the original tree. How many page reads and page writes does the insertion require? 3. Show the B+ tree that would result from deleting the data entry with key 8 from the original tree, assuming that the left sibling is checked for possible redistribution. 4. Show the B+ tree that would result from deleting the data entry with key 8 from the original tree, assuming that the right sibling is checked for possible redistribution. 5. Show the B+ tree that would result from starting with the original tree, inserting a data entry with key 46 and then deleting the data entry with key 52. 6. Show the B+ tree that would result from deleting the data entry with key 91 from the original tree. 7. Show the B+ tree that would result from starting with the original tree, inserting a data entry with key 59, and then deleting the data entry with key 91. 8. Show the B+ tree that would result from successively deleting the data entries with keys 32, 39, 41, 45, and 73 from the original tree. Answer 10.1 1. The data entry with key 9 is inserted on the second leaf page. The resulting tree is shown in figure 10.2. 2. The data entry with key 3 goes on the first leaf page F. Since F can accommodate at most four data entries (d = 2), F splits. The lowest data entry of the new leaf is given up to the ancestor which also splits. The result can be seen in figure 10.3. The insertion will require 5 page writes, 4 page reads and allocation of 2 new pages. 3. The data entry with key 8 is deleted, resulting in a leaf page N with less than two data entries. The left sibling L is checked for redistribution. Since L has more than two data entries, the remaining keys are redistributed between L and N, resulting in the tree in figure 10.4. 4. As is part 3, the data entry with key 8 is deleted from the leaf page N. Ns right sibling R is checked for redistribution, but R has the minimum number of keys. Therefore the two siblings merge. The key in the ancestor which distinguished between the newly merged leaves is deleted. The resulting tree is shown in figure 10.5. 5. The data entry with key 46 can be inserted without any structural changes in the tree. But the removal of the data entry with key 52 causes its leaf page L to merge with a sibling (we chose the right sibling). This results in the removal of a key in the ancestor A of L and thereby lowering the number of keys on A below the minimum number of keys. Since the left sibling B of A has more than the minimum number of keys, redistribution between A and B takes place. The final tree is depicted in figure 10.6. 6. Deleti
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025广东省农业科学院设施农业研究所招聘劳动合同制人员1人考前自测高频考点模拟试题附答案详解
- 2025广西旅发文化旅游股份有限公司招聘13人考前自测高频考点模拟试题参考答案详解
- 2025年陕西新华出版传媒集团新华书店分公司招聘笔试考前自测高频考点模拟试题(含答案详解)
- 2025江苏镇江市丹阳市卫生健康委员会所属丹阳市人民医院招聘22人(南京专场)考前自测高频考点模拟试题及答案详解参考
- 2025江西吉安市文化旅游投资发展集团有限公司及下属子公司招聘10人(第一批)考前自测高频考点模拟试题有完整答案详解
- 2025国家税务总局税务干部学院招聘事业单位工作人员36人考前自测高频考点模拟试题及1套参考答案详解
- 2025广东广州市中山大学孙逸仙纪念医院耳鼻喉科医技岗位招聘1人模拟试卷附答案详解(黄金题型)
- 2025阿勒泰市消防救援大队招聘编制外政府专职消防员(21人)模拟试卷及1套参考答案详解
- 2025湖南株洲市自然资源和规划局选聘模拟试卷及答案详解(名师系列)
- 2025湖北郧西县第一批事业单位引进高层次及急需紧缺人才39人模拟试卷及答案详解(名校卷)
- 企业内部控制流程培训资料
- 七年级体育与健康全册教案设计
- 2025湖北宜昌市不动产交易和登记中心招聘编外聘用人员17人考试参考题库及答案解析
- 《医学人工智能通识基础》全套教学课件
- 教育公共基础知识整理版
- 高中物理教学中劳动教育的融入析谈
- 装修合同明细
- 艾滋病梅毒和乙肝实验室检测
- GB/T 36393-2018土壤质量自然、近自然及耕作土壤调查程序指南
- GB/T 20028-2005硫化橡胶或热塑性橡胶应用阿累尼乌斯图推算寿命和最高使用温度
- 人力资源管理参考文献(汇总112个最新),参考文献
评论
0/150
提交评论