CS FundamentalsEasyGATE CS (PYQ pattern)
A relation R(A, B, C) holds the tuples (1,x,10), (1,y,20), (2,x,20), (2,z,30), (3,y,10). It is decomposed into R1 = π(A,B) R and R2 = π(B,C) R. How many spurious tuples (tuples not in R) appear in the natural join R1 ⋈ R2?
- A. 9
- B. 6
- C. 3
- D. 4
Correct answer: D. 4
R1 has the pairs [(1, 'x'), (1, 'y'), (2, 'x'), (2, 'z'), (3, 'y')], R2 has [('x', 10), ('x', 20), ('y', 10), ('y', 20), ('z', 30)]. The join has 9 tuples, of which 5 are original, so 4 are spurious (B does not determine A or C).
More DBMS and SQL questions
- Tables D(d): 1, 2, 3, 4. E(e, d, sal): (10,1,60), (11,1,40), (12,2,30), (13,3,70), (14,3,80), (15,NULL,90). How many rows does SELECT FROM…
- T(x) holds 1, 2, 3, 4, 5, 6, NULL and U(y) holds 2, 4, NULL. Let a, b, c be the row counts of (a) SELECT FROM T WHERE x NOT IN (SELECT y…
- Table S(id, v): (1,10), (2,20), (3,20), (4,30), (5,30), (6,40). SELECT SUM(v) OVER (ORDER BY v) AS s FROM S ORDER BY id; What is the sum…
- Table P(n, s): (a,90), (b,85), (c,85), (d,70), (e,70), (f,70), (g,60). A query computes r = RANK() OVER (ORDER BY s DESC) and d =…
- Table W(id, dept, sal): (1,A,50), (2,A,70), (3,A,90), (4,B,40), (5,B,40), (6,C,100), (7,C,20), (8,C,NULL), (9,D,NULL). SELECT COUNT() FROM…
- A1(x) holds 1, 1, 1, 2, 2, 3, NULL, NULL and B1(x) holds 1, 2, 2, 2, NULL, 4. Using the standard bag semantics (a value occurring m times…