Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Some examples for p() are: =v, v. We shall add a supplementary definition for the selection operation, such that p(R)r=r if KR with relation r(R).
Some examples for p() are: =v,v. We shall add a supplementary definition for the selection operation, such that p(R)r=r if KR with relation r(R). Now, suppose we get two relation schemas R and S. Relation schema R has (but may not only has) attributes ,, i.e., {,}R, while Relation schema S has attribute but doesn't have attribute , i.e., /S and S. Consider two non-empty relations r(R) and s(S) with the following two queries: - Query 1: p()(rr,=s,s) - Query 2: p()(r)r,=s,s (a) Determine if these two non-identical queries are equivalent. Please use relational algebra for rigorous proof (Hint: with the supplementary definition for operator select mentioned above, we suppose the select operator is of commutative property, that is p1(pn)=pn(pn); and we also suppose that the binary operator Cartesian product is of distributive property considering the unary operator select in this case, or say p()(rs)=p()(r)p()(s) with R and S using formal expression). (b) Tell which query is of higher efficiency. Here we shall compare the number of computational operations of the two queries. We suppose the query execution engine will use sequential search when making loops or checking records satisfying some condition, and the operation of looping and checking will not be counted twice. Denote the number of tuples in r as m, i.e., m=r1, and the number of tuples in s as n, i.e., n=s1. Suppose the fraction of returned tuples after selection over r to that of the original r is fp()(r) to r is f, that is, f=p()(r)/m. We shall have 0f1 (Hint: calculate the difference of the number of operations and compare it with 0 ). (c) Check the last page (excluding the ending page) of Chapter 2 of our lecture slides (that should be Page 31 ). Write down what you've found
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started