GATE CSE 2019 Q65: Tuples returned by difference of two relational algebra projections
- Databases
- 2 marks
- NAT
- No negative marking
Syllabus topic: Relational model: relational algebra, tuple calculus and SQL
Question
Consider the following relations P(X,Y,Z), Q(X,Y,T) and R(Y,V).
| X | Y | Z |
|---|---|---|
| X1 | Y1 | Z1 |
| X1 | Y1 | Z2 |
| X2 | Y2 | Z2 |
| X2 | Y4 | Z4 |
| X | Y | T |
|---|---|---|
| X2 | Y1 | 2 |
| X1 | Y2 | 5 |
| X1 | Y1 | 6 |
| X3 | Y3 | 1 |
| Y | V |
|---|---|
| Y1 | V1 |
| Y3 | V2 |
| Y2 | V3 |
| Y2 | V2 |
How many tuples will be returned by the following relational algebra query?
Answer: ________.
Try it: numerical answer: type the value
Show answer and explanation
Answer: 1 (official GATE 2019 final answer key)
Concept used: A selection with an equality on the common attribute over a Cartesian product acts as a join; projection removes duplicates, and set difference keeps the values in the first result that are not in the second.
First step: Find the Y values in R with V = V2 and the X values of P rows having those Y; separately find the X values of Q rows with T > 2 whose Y appears in R; then subtract the second set from the first.
Full step-by-step solution
Loading…
Answer from the official final answer key. Found a mistake? Use Report issue and we will fix it.
More questions on Relational model: relational algebra, tuple calculus and SQL
Every PYQ on this topic →Share this question
Source: official GATE 2019 CS question paper and final answer key, organised by IIT Madras. Question paper · Answer key
More Databases PYQs
- 2026 Session 1 · Q30Which functional dependency inferences always hold
- 2026 Session 1 · Q31Dependency-preserving decompositions for 1NF, 2NF, 3NF, BCNF
- 2026 Session 1 · Q43Relational algebra equivalent of a tuple calculus join query
- 2026 Session 1 · Q65Number of superkeys with candidate keys {A,B} and {A,C}
- 2026 Session 2 · Q15Match DBMS schema levels with what they describe
- 2026 Session 2 · Q20When two transactions do not conflict on a data item