84 views
2 2 votes

Consider $\mathrm{X}(\mathrm{A},\mathrm{B})$ and $\mathrm{Y}(\mathrm{B},\mathrm{C})$.

Which expression is equivalent to $\sigma_{\mathrm{A}<15\land\mathrm{C}\geq10}(\mathrm{X}\bowtie\mathrm{Y})$ after pushing selections as far down as possible?

  1. $\sigma_{\mathrm{A}<15}(\mathrm{X})\bowtie\sigma_{\mathrm{C}\geq10}(\mathrm{Y})$
     
  2. $\sigma_{\mathrm{A}<15\land\mathrm{C}\geq10}(\mathrm{X})\bowtie\mathrm{Y}$
     
  3. $\sigma_{\mathrm{A}<15}(\mathrm{X})\bowtie\mathrm{Y}$
     
  4. $\sigma_{\mathrm{A}<15}(\mathrm{X})\cup\sigma_{\mathrm{C}\geq10}(\mathrm{Y})$

1 Answer

0 0 votes

The predicate $\mathrm{A}<15$ depends only on attribute $\mathrm{A}$.

Since $\mathrm{A}$ occurs only in $\mathrm{X}$, this condition can be applied directly to $\mathrm{X}$:

$\sigma_{\mathrm{A}<15}(\mathrm{X})$.

Similarly, $\mathrm{C}\geq10$ depends only on $\mathrm{Y}$:

$\sigma_{\mathrm{C}\geq10}(\mathrm{Y})$.

Therefore, both selections can be performed before the join:

$\boxed{\sigma_{\mathrm{A}<15}(\mathrm{X})\bowtie\sigma_{\mathrm{C}\geq10}(\mathrm{Y})}$.

This reduces the relations before the join while preserving the result.

B is not valid because $\mathrm{C}$ does not belong to $\mathrm{X}$.

C fails to enforce $\mathrm{C}\geq10$.

D changes a join query into a union and is not even union-compatible here.

Hence, the correct answer is A.

Answer:
Position:
Show:

Related questions

1 1 vote
1 1 answer
118
118 views
GO Classes asked Sep 25
118 views
Consider two relations $\mathrm{r}$ and $\mathrm{s}$ with schemas $\mathrm{R(A,B,C)}$ and $\mathrm{S(A,B,D)}$, respectively.The query is $\pi_{\mathrm{A}}(\sigma_{\mathrm...
0 0 votes
1 1 answer
158
158 views
GO Classes asked Sep 25
158 views
Consider $\mathrm{Flights}(\mathrm{num},\mathrm{src},\mathrm{dst})$, where each tuple represents a directed flight from $\mathrm{src}$ to $\mathrm{dst}$.Let $\mathrm{F}_1...
0 0 votes
1 1 answer
120
120 views
GO Classes asked Sep 25
120 views
Consider $\mathrm{Employee}(\mathrm{eid},\mathrm{name},\mathrm{salary})$, $\mathrm{Project}(\mathrm{pid},\mathrm{title},\mathrm{budget})$, and $\mathrm{WorksOn}(\mathrm{e...
2 2 votes
1 1 answer
108
108 views
GO Classes asked Sep 25
108 views
Consider $\mathrm{Locations}(\mathrm{locationid},\mathrm{name},\mathrm{state},\mathrm{altitude})$$\mathrm{TreeCoverage}(\mathrm{locationid},\mathrm{treetype},\mathrm{year...