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?

  1. A. 1, 3, 4
  2. B. 4, 6, 5
  3. C. 3, 4, 5
  4. 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

Exams that ask this topic