Management & CommerceVery hardBusiness analyst · KPO · MBA placement pattern

Table orders(dt, amount) has rows (1 Jan, 100), (2 Jan, 50), (2 Jan, 70), (3 Jan, 30). A query adds SUM(amount) OVER (ORDER BY dt) with no frame clause. What running-total value appears on the row (2 Jan, 50)?

  1. A. 150
  2. B. 170
  3. C. 220
  4. D. 250

Correct answer: C. 220

With ORDER BY and no frame, the default frame is RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW, which includes all peer rows with the same dt. Both 2 Jan rows therefore show 100 + 50 + 70 = 220. 150 (or 170) is what a ROWS frame would give, depending on the row order; 250 is the grand total.

More Operations, Supply Chain & Business Analytics questions

Exams that ask this topic