CS FundamentalsHardGATE CS (PYQ pattern)
Table V(id, v): (1,40), (2,10), (3,40), (4,30), (5,20), (6,30). What are the ids returned, in order, by SELECT id FROM V ORDER BY v DESC, id LIMIT 3 OFFSET 1?
- A. 1, 3, 4
- B. 4, 6, 5
- C. 3, 4, 5
- D. 3, 4, 6
Correct answer: D. 3, 4, 6
Order: (1,40), (3,40), (4,30), (6,30), (5,20), (2,10). OFFSET 1 skips id 1; LIMIT 3 takes ids 3, 4, 6.
More DBMS and SQL questions
- P1(id, name, dept): (1,a,10), (2,b,20), (3,c,10). P2(id, name, city): (1,a,X), (2,z,Y), (4,d,Z). How many rows does SELECT FROM P1 NATURAL…
- DP(d): 1, 2, 3. EP(e, d): (1,1), (2,1), (3,1), (4,3). For SELECT DP.d, COUNT() AS a, COUNT(EP.e) AS b FROM DP LEFT JOIN EP ON DP.d = EP.d…
- SL(r, q, amt): (N,Q1,10), (N,Q2,20), (S,Q1,5), (S,Q1,15), (S,Q2,NULL), (E,Q2,7). The query SELECT r, SUM(CASE WHEN q = 'Q1' THEN amt END)…
- Schedule: R1(A), W2(A), R3(B), R2(B), W3(C), W1(C), R4(D). How many different serial orders of T1, T2, T3, T4 are conflict-equivalent to it?
- Schedule (no commits yet): W1(A), R2(A), W2(B), R3(B), R4(C), W3(C), R5(D), W4(D). T1 now aborts. Which set of transactions must also be…
- Which of the following statements about the SQL standard isolation levels (locking-based implementation) are correct? I. READ COMMITTED…