GATE CSE
First time here? Checkout the FAQ!
x
+6 votes
289 views

What is the optimized version of the relation algebra expression $\pi_{A1}(\pi_{A2}(\sigma_{F1}(\sigma_{F2}(r))))$, where $A1, A2$ are sets of attributes in $r$ with  $A1 \subset A2$ and $F1,F2$ are Boolean expressions based on the attributes in $r$?

(A) $\pi_{A1}(\sigma_{(F1 \wedge F2)}(r))$

(B) $\pi_{A1}(\sigma_{(F1 \vee F2)}(r))$

(C) $\pi_{A2}(\sigma_{(F1 \wedge F2)}(r))$

(D) $\pi_{A2}(\sigma_{(F1 \vee F2)}(r))$

asked in Databases by Veteran (73.2k points)  
edited by | 289 views

1 Answer

+13 votes
Best answer

(A) πA1(σ(F1∧F2)(r))

since A1 is subset of A2 will get only A1 attributes as it is in the outside, so we can remove project A2.

Two Selects with boolean expression can be combined into one select with And of two boolean expressions.

answered by Loyal (3.1k points)  
edited by
Top Users Jan 2017
  1. Debashish Deka

    7050 Points

  2. Habibkhan

    4674 Points

  3. Vijay Thakur

    4224 Points

  4. saurabh rai

    4008 Points

  5. sudsho

    3960 Points

  6. Arjun

    3108 Points

  7. GateSet

    3088 Points

  8. santhoshdevulapally

    3004 Points

  9. Bikram

    2976 Points

  10. Sushant Gokhale

    2744 Points

Monthly Topper: Rs. 500 gift card

18,810 questions
23,777 answers
51,413 comments
20,128 users