《数据库复习题2答案1数据库》由会员分享,可在线阅读,更多相关《数据库复习题2答案1数据库(9页珍藏版)》请在金锄头文库上搜索。
1、um:integer,sname:char(30),majolation.Assumethatthebuffersizeamecoursetwice).TwopossibleansofthepagesinthefilerandomlyAn=1bcaG =2bca bc cG-复习题 21、 试分别判断以下图中G1和G2是否互模拟(bisimulation),并说明理由:a aG1bcdaG2d d答案:(1) 在图中标出各点的状态,我们构造关系,可知 G2 可以模拟 G1 ,下面我们讨论是否可模拟,在 G2 中 有一个 a 变换可对应到 G1 中 2 个变换,即 ,。但 有两个变换 b,c,而
2、在 G1 中仅存在只有 b 或只有 c 的状态点,可知 G1 和 G2 不能互模拟。(2) 如图,标出各状态点,构造有关系可知其中 G1 中的点均可由 G2 中的点模拟,下面我们考虑可知同样其中 G2 中的点均可由 G1 中的点模拟. 所以 G1 和 G2 为互模拟的。. z.ouldyouremendforthebuffermanagrefficientbuffermanagementQue.27Query1:selectbuilding,roomnthetrack-to-trackseektimeis1ms-2、 给定如下数据图(Data Graph) :试给出其 Strong DataG
3、uide 图答案:r1personworks-forp1,p2,p3ceop1,p3nameaddresss3,s7phone positionemployee p2managess0,s4,s8c1,c2names2,s6s1,s9urls10s5Strong DataGuide 图3、 Consider the relation, r , shown inFigure 5.2.7Give the result of the followingquery:Figure 5.27Query 1:selectbuilding, room number, time_slo_ id, count(*
4、)from rgroup by rollup(building, room number, time_slo_ iQuery 1:selectbuilding, room number, time_slo_ id, count(*)from rgroup by cub(uilding, room number, time_slo_ i答案:Query 1返回结果集:为以下四种分组统计结果集的并集且未去掉重复数据。building room number time_slo_ id count(*)产生的分组种数: 4 种;第一种: group by A,B,CGarfield 359 A 1.
5、z.-umber,timesloid,count(*)fromrgr,ame:char(40)Thefollowingind550705403ABACDD212122第八种:groupr),aswellasitsstartandendaddreB 1A 1C 1D 1D 1第二种: group by A,B221111第三种: group by A222222第四种: group by NULL 。本没有 group by NULL的写法,在这里指是为了方便说明,而 采用之。含义是:没有分组,也就是所有数据做一个统计。例如聚合函数是 SUM的话,那就是对所有满足条件的数据进展求和。Garfie
6、ldGarfieldSauconSauconPainterPainterGarfieldGarfieldGarfieldGarfieldGarfieldPainterPainterPainterPainterPainterPainterSauconSauconSauconSauconSauconSaucon403403403403359359359359359359359705705705705550550550550651651651651AAAAAADDDDDDCCCBBB666666Query 2:group by 后带 rollup 子句与 group by 后带 cube 子句的唯一
7、区别就是:带 cube 子句的 group by 会产生更多的分组统计数据。 cube 后的列有多少种组合注意组合 是与顺序无关的就会有多少种分组。返回结果集:为以下八种分组统计结果集的并集且未去掉重复数据。building room number time_slo_ id count(*)产生的分组种数: 8 种第一种: group by A,B,CGarfieldGarfieldSauconSauconPainterPainterC 1A 1B 1A 1D 1D 1403359359705550651. z.fieldGarfieldSauconSauconPaintSowecanuseL
8、RU.-LIFO(LastInFirsdatain500,000sectors.Thereforewers:-TheB+Treepagesclosetothe第二种: group by A,BGarfieldGarfieldSauconSauconPainterPainter359359651550705403ABACDD221111第三种: group by A,CGarfieldGarfieldSauconSauconPainterPainter359359651550705403ABACDD111122第四种: group by B,CGarfieldGarfieldSauconSauc
9、onPainterPainter359359651550705403ABACDD221111第五种: group by AGarfieldGarfieldSauconSauconPainterPainter359359651550705403ABACDD222222第六种: group by BGarfieldGarfieldSauconSauconPainterPainter359359651550705403ABACDD221111第七种: group by CGarfieldGarfieldSauconSauconPainterPainter359359651550705403ABACD
10、D212122第八种: group by NULL. z.doesnotallowastudenttotakethesofthepagesinthefilerandomlyAnherotationaldelay(othernumbersateplacesinyourcalculation).(a-GarfieldGarfieldSauconSauconPainterPainter359359651550705403ABACDD6666664、 Disks and Access TimCsider a disk with a sector扇区 size of 512 bytes, 63 sect
11、ors per track磁道, 16,383 tracks per surface盘面, 8 double-sidedplatters柱面 (i.e., 16 surfaces). The disk platters rotate at 7,200 rpm (revolutions per minute). The average seektime is 9 msec, whereas the track-to-track seek time is 1 msec. Suppose that a page size of 4096 bytes is chosen. Suppose that a file containing 1,000,000 records of 256bytes each is to be stored on such a disk. No record is allowed to span two pages (use these numbers in appropriate places inyour calculation).