Relational Algebra in DBMS

Last Updated :
Discuss
Comments

Question 1

Suppose (A, B) and (C, D) are two relation schemas. Let r1 and r2 be the corresponding relation instances. B is a foreign key that refers to C in r2. If data in r1 and r2 satisfy referential integrity constraints, which of the following is always true?

(GATE 2012 | MCQ | 1-Mark)

  • [Tex]\Pi_B(r_1) - \Pi_C(r_2) = \emptyset[/Tex]

  • [Tex]\Pi_C(r_2) - \Pi_B(r_1) = \emptyset[/Tex]

  • [Tex]\Pi_B(r_1) = \Pi_C(r_2)[/Tex]

  • [Tex]\Pi_B(r_1) - \Pi_C(r_2)[/Tex][Tex]\emptyset[/Tex]

Question 2

What is the result of ∏ADDRESS(STUDENT) where STUDENT has duplicate 'DELHI' addresses?

  • Returns all addresses including duplicates

  • Returns only unique addresses

  • Returns an error due to duplicate elimination

  • Returns NULL values for duplicates

Question 3

Consider the relations R(A, B) and (B, C). Let the result of the following relational algebra expression be relation T:

[Tex]T = (\Pi_{A}(R)) - (\Pi_{A}(R \bowtie S))[/Tex]

Which of the following statements correctly describes the contents of relation T?

(GATE 2022 | MCQ | 2-Mark)

  • T contains values of A that are present in R and have at least one matching tuple in S

  • T contains values of A that are present in R and do not have any matching tuple in S

  • T contains values of A that are present in both R and S

  • T is always empty

Question 4

Which of the following operations on two relations R and S cannot be implemented using only the basic relational algebra operators (Selection [Tex]\sigma[/Tex], Projection [Tex]\pi[/Tex], Cartesian Product $\times$, Union [Tex]\cup[/Tex], and Set Difference -)?

(GATE 2021 | MCQ | 1-Mark)

  • Left Outer Join [Tex](\bowtie_{L})[/Tex]

  • Division [Tex](\div)[/Tex]

  • Intersection [Tex](\cap)[/Tex]

  • None

Question 5

Which of the following relational algebra expressions is/are not logically equivalent to the relational intersection operation [Tex]R \cap S[/Tex], assuming R and S are two union-compatible relations?

(GATE 2021 | MCQ | 1-Mark)

  • R - (R - S)

  • S - (S - R)

  • [Tex](R \cup S) - ((R - S) \cup (S - R))[/Tex]

  • [Tex](R - S) \cup (S - R)[/Tex]

Question 6

The Relational Division operator ([Tex]\div[/Tex]) is a specialized extended operator. If relation R has attributes (X, Y) and relation S has attribute (Y), which of the following processes or components is/are NOT a valid intermediate step when evaluating the division expression [Tex]\pi_X(R)[/Tex] - [Tex]\pi_X((\pi_X(R) \times S) - R)[/Tex]?

(GATE 2021 | MCQ | 1-Mark)

  • Finding all theoretically possible pairings of X values from R with all Y values from S via a Cartesian Product.

  • Filtering out pairs that actually exist in the original relation R using Set Difference

  • Finding the intersection of attributes between R and S using a Natural Join condition

  • Projecting the disqualified X values to subtract them from the absolute pool of all X values

Question 7

Which operation implements "students who don't play any sports"?

  • STUDENT - STUDENT_SPORTS

  • ROLL_NO(STUDENT) - ∏ROLL_NO(STUDENT_SPORTS)

  • σ(ROLL_NO=NULL)(STUDENT ⋈ STUDENT_SPORTS)

  • STUDENT ÷ STUDENT_SPORTS

Question 8

Consider the following relations A, B, C. How many tuples does the result of the following relational algebra expression contain? Assume that the schema of A U B is the same as that of A.

[Tex](A \cup B) \bowtie_{A.Id > 40 \vee C.Id < 15} C[/Tex]

Table A
Id Name Age
----------------
12 Arun 60
15 Shreya 24
99 Rohit 11

Table B
Id Name Age
----------------
15 Shreya 24
25 Hari 40
98 Rohit 20
99 Rohit 11

Table C
Id Phone Area
-----------------
10 2200 02
99 2100 01

(GATE 2012 | MCQ | 2-Mark)

  • 7

  • 4

  • 5

  • 9

Question 9

Which relational algebra expression is equivalent to SQL's LEFT JOIN?

  • R ⋈ S

  • R ⟕ S

  • (R × S) ∪ (R × (∏(NULL,...,NULL)(S)))

  • (R ⋈ S) ∪ (R - ∏R.*(R ⋈ S))

Question 10

What distinguishes θ-join from equijoin?

  • θ-join uses only = operator

  • Equijoin eliminates duplicate columns

  • θ-join supports inequality conditions

  • Equijoin requires natural join

There are 10 questions to complete.

Take a part in the ongoing discussion