Each row of the following table shows two queries. In the blank third column of
ID: 3878518 • Letter: E
Question
Each row of the following table shows two queries. In the blank third column of the table write "YES" if the two queries are equivalent, and "NO" if they are not equivalent. 5. All queries refer to a schema containing two relations: R(A, B) where A is a key and B is a key. S(A, B) where A is a key. You may assume the relations do not contain NULL values. Query 1 TA(R - S) TB(R- S) Query 2 TA(R) TA(S) TBR) TB(S) quiv.? select R . A from R,S where R.B=$.B select R.B from R,S where R. A-s. A select min(B) from R TB(R) select max (B) from RExplanation / Answer
1. NO
if R={(1,2),(1,3)} and S={(1,1),(1,2)} then
query1= {(1)} while query2 = {}
2. NO
if R={(1,2),(1,3)} and S={(1,1),(1,2)} then
query1= {(1)} while query2 = {(2)}
3. YES
As all the tuples will be included. Hence, both queries are equivalent.
if R={(1,2),(2,3)} and S={(1,1),(1,2)} then
query1= {(1),(2),(3)} while query2 = {(1),(2),(3)}
4. NO
Since, the result of join operation will have only those tuples for which the value of R.A and S.A are same. Hence, the two queries are not equivalent.
if R={(5,2),(2,3)} and S={(1,1),(2,2)} then
query1= {(5,2)} while query2 = { }
5. YES.
Query2 is the SQL statement for query1.
6. YES
Query2 is the SQL statement for query1.
7. YES
Since, the selection on the cross product will select those tuples whose R1.B is atleast greater than one of the element. The projection will select all the elements except the minimum. Hence, the result is min(R.B)
8. YES
Since, the selection on the cross product will select those tuples whose R1.B is atleast smallerr than one of the element. The projection will select all the elements except the maximum. Hence, the result is max(R.B)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.