Q1: Select r.a, r.c From R r Where NOT EXISTS (Select s.a From S s Where s.b > '4' and r.a = s.a) Q2: Select r.a, r.c From R r, (select distinct S.a, S.b From S) s Where NOT (r.a = s.a and s.b > '4')
Q1: SELECT A FROM R NATURAL JOIN S GROUPBY A HAVING COUNT(*) < 2 Q2: SELECT A FROM R WHERE B NOT IN (SELECT B FROM S GROUPBY B HAVING COUNT(*) > 1)Treating Q1 and Q2 as multisets (bags), which one of the following is true? Prove your answer (perhaps, by using a counter example or otherwise).
. Q1 and Q2 always produce the same answer for all databases. . The answer to Q1 is always contained in the answer to Q2 for all databases. . The answer to Q2 is always contained in the answer to Q1 for all databases. . None of the above.