retagged by
15,512 views
48 votes
48 votes

Consider the relations $r(A, B)$ and $s(B, C)$, where $s.B$ is a primary key and $r.B$ is a foreign key referencing $s.B$. Consider the query

$Q: r \bowtie (\sigma_{B<5} (s))$

Let LOJ denote the natural left outer-join operation. Assume that $r$ and $s$ contain no null values.

Which of the following is NOT equivalent to $Q$?

  1. $\sigma_{B<5} (r \bowtie s)$
  2. $\sigma_{B<5} (r \: LOJ \: s)$
  3. $r \: LOJ \: (\sigma_{B<5}  (s))$
  4. $\sigma_{B<5} (r) \: LOJ \: s$
retagged by

4 Answers

Best answer
41 votes
41 votes

Option $a,b,d$ will restrict all record with $B<5$ but option C will include record with $b>=5$ also, so false.

C is the answer.

edited by
54 votes
54 votes

Answer should be C.

Here r.B is foreign key and s.B is primary key.(r.B) is foreign key referencing (s.B).It means which input you put in r.B,it must belongs to s.B.

 

edited by
1 votes
1 votes

Answer C is correct as C produces extra spurious tupples which are not produced by Q as in opt C select operation is insidé which doesn't limits the number of tupples which are printed using LOJ please correct the format of answer is wrong as ther is no natural join symbol @jothee ma'am

@bhavya bhatia follow this example simple and correct for answer C

ps: sorry for bad photo as low camera confighttps://gateoverflow.in/?qa=blob&qa_blobid=7719351029757488468

0 votes
0 votes
r.B is proper subset of s.B thats why option C can’t be equivalent to query Q . Remeber r table contains no null values.
Answer:

Related questions