Questions Based on Relational Algebra (Gate Questions Included) -Part 2

Question 21: Consider the relation Student(name,sex, marks) where the
             primary key is shown underlined, pertaining to students
             in a class that has at least one boy and one girl. What
             does the following relational algebra expression 
             produce?
Questions Based on Relational Algebra - Consider the relation Student(name,sex, marks) where the primary key is shown underlined(Gate 2004)
a) names of girl students with the highest marks
b) names of girl students with more marks than some boy student 
c) names of girl students with marks less than some boy student
d) names of girl students with more marks than all the boy students
                                                         [GATE 2004]
Solution :
          Consider the relation Student(name,sex, marks) where the primary key is shown underlined, pertaining to students in a class that has at least one boy and one girl. - Questions Based on Relational Algebra
             ⇒ (d) is the right answer
Question 22 : Let R and S be two relations with the following schema 
              R(P,Q,R1,R2,R3)
              S(P,Q,S1,S2)
              Where {P,Q} is the key for both schemas.
              Which of the following queries are equivalent?
              Let R and S be two relations with the following schema R(P,Q.R1,R2,R3) (Gate 2008) - Questions Based on Relational Algebra
              a) Only I and II
              b) Only I and III
              c) Only I II and III
              d) Only I III and IV
                                                          [GATE 2008]
Solution : Let the relation R(P,Q,R1,R2,R3) and S(P,Q,S1,S2) be
P Q R1 R2 R3
p1 q2
p2 q2
p3 q1
P Q S1 S2
p1 q2
p2 q3
Case I ) The query join the relation R and S then project the column P
         only.

Case II) The query project the column P from R and S and join these
         projected column .


Let R and S be two relations with the following schema R(P,Q,R1,R2,R3) S(P,Q,S1,S2) - Questions Based on Relational Algebra

Case III) The given query project separately the column P and Q in both
          relation R and S. The intersection produces only those column
          which are common in both and finally projection produces the
          result the column P.

Case IV) The given query project the column P and Q in both relations 
         R and S separately. The difference of say A and B produces those
         only those column which are not in B but in A. And finally
         projection produces the result the column P.

Let R and S be two relations with the following schema R(P,Q,R1,R2,R3) S(P,Q,S1,S2) - Questions Based on Relational Algebra
Question 23: Given two relations R1 and R2, where R1 contains N1
             tuples and R2 contains N2 tuples, and N2 > N1 > 0, 
             give the maximum and minimum possible sizes (in tuples)
             for the result relation produced by each of the
             following relational algebra expressions. In each case,
             state any assumptions about the schemas for R1 and R2 
             that are needed to make the expression meaningful. 
             (a) R1 ∪ R2
             (b) R1 ∩ R2
             (c) R1 - R2
             (d) R1 × R2
             (e) σa=5(R1)
             (f) πa (R1)
             (g) R1/R2
Solution : 
          a) R1 ∪ R2 
             Assumption: R1 and R2 are union compatible 
             Min: N2
             Max: N1 + N2 
         (b) R1 ∩ R2 
             Assumption: R1 and R2 are union compatible 
             Min: 0
             Max: N1 
         (c) R1 - R2 
             Assumption: R1 and R2 are union compatible
             Min: 0
             Max: N1 
         (d) R1 × R2 
             Min: N1 * N2 
             Max: N1 * N2 
         (e) σa=5(R1)
             Assumption: R1 has an attribute named a 
             Min: 0 
             Max: N1 
         (f) πa (R1)
             Assumption: R1 has an attribute named a
             Min: 1
             Max: N1 
         (g) R1/R2 
             Assumption: The set of attributes of R2 is a subset of
             the attributes of R1.
             Min: 0
             Max: 0

Previous Home Next
Questions on Relational Algebra (Part 1) Relational Calculus with some Questions

     

Incoming search terms:

  • relational algebra query questions and answers
  • relational algebra in dbms questions and answers
  • gate 98 question on relational algebra
  • relational algebra in dbms practice questions answers
  • Questions on relational
  • questions and solutions of relational algebra and calculus
  • relational algebra questions in dbms
  • question of relation algebra com
  • problems on relational algebra in dbms
  • relational algebra prob

Leave a Reply