Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
1. Using algorithm 15.2, find a minimum cover for the set of FDs: G = {A → C, AB → C, C → DI, CD → I, (2) EC → AB, EI → C} Answer: Make sure that the right-hand side of each functional dependency is composed of a single attribute. Hint: the minimal cover contains six functional dependencies, where the right-hand side of each FD contains only single attribute. G = {A → C, C → D, C → I, EC → A, EC → B, EI → C} Reasoning: (i) AB → C is implied by A → C and is redundant. (ii) C → DI means C→ D and C→ I. C → I makes CD → I redundant. (iii) EC → AB can be rewritten as EC → A, EC → B 2. Consider relation R(ABCDEFH) and the following functional dependencies: BC → DE a. A→B AB → E Give the complete closure for AC, i.e., find (AC)+. AE → H (1) Answer: ABCDEH b. Using algorithm 15.2(a), what is the key of R? Answer: ACF 1/4 (1) 3. Suppose there is a B+-tree index on OrderNo of the relation Orders(OrderNo, CustID, Date). a. If order numbers are assigned sequentially in order of the arrival of orders (1, 2, 3, ...), is it better to use a dense or sparse index? Very briefly, why? (2) Answer: b. Circle: Dense Sparse Why? Since the values of OrderNo are arriving sorted What if the only index on Orders is going to be a B+-tree on CustID. Is it better to use a dense or sparse index? Very briefly, why? (2) Answer: 4. Circle: Dense Sparse Why? Since we are not sure if the values of CustID are stored sorted or not Consider a B+-tree of order f = 100 over a relation with 1 million records. What is the number of nodes in the tree that we have to examine when searching for a record? Answer: In the best case, when all nodes are full = logf(n) = log100(106) = 3 nodes In the worst case, when all nodes are half full = logf/2(n) = log50(106) = 3.53 = 4 nodes 2/4 (2) Suppose we have the following statistics: • |R| = 1000; |πA R| = 100; |πB R| = 10; • |S| = 5,000; |πC S| = 300; |πD S| = 10; • |T| = 4,000; |πD T| = 4,000; |πE T| = 1,500. |πC R| = 500; Estimate the number of the tuples returned by the following queries: (b) σB=50 R (1) 1000 * 1/10 = 100 (c) σA=10 and B=“Bart” R (1) 1000 * 1/100 * 1/10 = 1 (d) σA=10 or B=”Bart” R (1) 1000 * (1/100 + 10/100) = 110 (e) RS join on attribute C 3/4 (1) 8. Consider the following schedule S, consisting of transactions T1, T2 and T3. T1 W(A) T2 (4) T3 R(A) W(B) W(B) W(B) W(A) R(B) R(B) a. Draw the precedence graph for S. B B B A, B b. Is S conflict serializable? Circle Yes c. Why?Justify your answer. d. If yes, it is equivalent to serial schedule of ___________. No S is not conflict serializable because there is a circle T1- T3- T1 4/4