CS FundamentalsHardGATE CS

Sc(n, s) holds (a, 90), (b, 85), (c, 85), (d, 80), (e, 70). For the row of n = 'd', what are RANK() OVER (ORDER BY s DESC) and DENSE_RANK() OVER (ORDER BY s DESC), in that order?

  1. A. 4, 3
  2. B. 3, 3
  3. C. 4, 4
  4. D. 3, 4

Correct answer: A. 4, 3

The tie at 85 takes ranks 2 and 2, so RANK skips to 4 for 80, while DENSE_RANK leaves no gap and gives 3.

More DBMS and SQL questions

Exams that ask this topic