GATE | GATE CS 2019 | Question 63
Consider the following relation P(X, Y, Z), Q(X, Y, T) and R(Y, V):

How many tuples will be returned by the following relational algebra query?
πx(σ(P.Y = R.Y ∧ R.V = V(P X R))) - πx(σ(Q.Y = R.Y ∧ Q.T > 2(Q X R)))
Note: This was Numerical Type question.
(A) 3
(B) 1
(C) 2
(D) 4
Answer: (B)
Explanation: Query-1:
πx(σ(P.Y = R.Y ∧ R.V = V(P X R)))
It will satisfy only one row:
X Y Z Y V ------------------- X2 Y2 Z2 Y2 V2 -------------------
Only column X will be selected.
X ----- X2 -----
Query-2:
πx(σ(Q.Y = R.Y ∧ Q.T > 2(Q X R)))
It will satisfy only two row:
X Y T Y V ------------------- X1 Y2 5 Y2 V3 X1 Y1 6 Y1 V1 -------------------
Only column X will be selected.
X ----- X1 -----
Note that relational algebra return unique tuples only.
Now,
= πx(σ(P.Y = R.Y ∧ R.V = V(P X R))) = (Query-1) - (Query-2) = X2 - X1 = X2
So, answer is 1.
Note that {(Query-1) – (Query-2)} will return all tuples from query-1 those are not in query-2.
Quiz of this Question
Recommended Posts:
- GATE | GATE CS 1999 | Question 36
- GATE | GATE CS Mock 2018 | Question 39
- Top 5 Topics for Each Section of GATE CS Syllabus
- How to prepare in Last 10 days to score high in GATE?
- Aptitude | GATE IT 2006 | Question 7
- Aptitude | GATE IT 2006 | Question 8
- GATE | GATE CS 2013 | Question 1
- GATE | GATE CS 2013 | Question 3
- GATE | GATE CS 2013 | Question 4
- GATE | GATE CS 2013 | Question 65
- GATE | GATE CS 2013 | Question 6
- GATE | GATE CS 2013 | Question 7
- GATE | GATE CS 2013 | Question 8
- GATE | GATE CS 2013 | Question 65
- GATE | GATE CS 2013 | Question 65



