1. The relation R(a,b) may have duplicate tuples. Which of the following queries
ID: 3890405 • Letter: 1
Question
1. The relation R(a,b) may have duplicate tuples. Which of the following queries has a result that is guaranteed not to have duplicates, regardless of what tuples R contains? a) SELECT a, AVG(b) FROM R GROUP BY a b) SELECT b FROM R WHERE a = b c) SELECT a FROM R WHERE a >= ALL (SELECT a FROM R) d) SELECT a FROM R WHERE a = 1 2. Relation R(a,b) has no duplicate tuples, although neither a nor b is a key. Relation S(c,d) may have duplicates. Which of the following queries is guaranteed to produce no duplicates? a) SELECT c, d FROM S WHERE c IN (SELECT a FROM R) AND d IN (SELECT b FROM R) b) SELECT S.c, S.d FROM R, S WHERE R.a = S.d AND R.b = S.c c) SELECT c FROM S WHERE c = d d) SELECT c, d FROM S GROUP BY c, d 1. The relation R(a,b) may have duplicate tuples. Which of the following queries has a result that is guaranteed not to have duplicates, regardless of what tuples R contains?Explanation / Answer
1)Answer:
Here you have given that
the relation R(a,b) may have duplicate tuples.
SO for getting the result that is guaranteed not to have duplicates
SELECT a FROM R WHERE a = 1
2)Answer:
Given that Relation R(a,b) has no duplicate tuples and a nor b is a key
and we have Relation S(c,d) may have duplicates
So that
SELECT S.c, S.d FROM R, S WHERE R.a = S.d AND R.b = S.c
Hope this will helps you...
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.