CS FundamentalsHardGATE CS (PYQ pattern)
O(oid, c): (1,100), (2,100), (3,200), (4,NULL). I(oid, p, q): (1,5,2), (1,6,1), (2,5,3), (3,7,1), (3,7,1), (9,1,1). C(c, n): (100,u), (100,v), (200,w), (300,z). How many rows does SELECT * FROM O JOIN I ON O.oid = I.oid JOIN C ON O.c = C.c return?
- A. 5
- B. 9
- C. 10
- D. 8
Correct answer: D. 8
O ⋈ I gives 5 rows (oid 1 twice, 2 once, 3 twice; oid 4 and 9 do not match). Joining C on c: customer 100 has two names, so rows for oid 1 and 2 double (3 rows become 6), and oid 3 matches one name (2 rows): 8.
More DBMS and SQL questions
- Transaction T1 executes R1(A), W1(A), R1(B) and T2 executes W2(A), R2(B), W2(B), each in the stated order (no commits modelled). Among all…
- Consider the schedule R2(X), W1(X), W2(X), W2(Y), C2, R1(Y), C1, W3(X), R3(X), C3 (Ci is the commit of Ti). Which is the strongest…
- Schedule S: R1(X), W2(X), W2(Y), W1(Y), W3(X), W3(Y), R3(Y). Which statement is correct?
- Basic timestamp ordering with TS(T1) < TS(T2) < TS(T3). A transaction aborts when it violates the rules, and once aborted its later…
- A system uses immediate database modification with a log. Log (oldest first): <T1 start>, <T1,A,10,20>, <T2 start>, <T2,B,5,6>, <T1…
- A 10,000-page file is sorted by external merge sort with 21 buffer pages: later passes merge 20 runs at a time, and every pass reads and…