Management & CommerceHardBusiness analyst · KPO · MBA placement pattern

Table daily(day, amount) has rows (1, 120), (2, 80), (3, 100), (4, 160), (5, 140). What values does AVG(amount) OVER (ORDER BY day ROWS BETWEEN 2 PRECEDING AND CURRENT ROW) give for day 2 and day 5?

  1. A. 100 and 133.33
  2. B. 66.67 and 133.33
  3. C. NULL and 133.33
  4. D. 100 and 120.00

Correct answer: A. 100 and 133.33

The frame for day 2 has only days 1–2 (no earlier row exists), so AVG = (120 + 80) ÷ 2 = 100 — AVG divides by the rows present, not by 3. Day 5 averages days 3–5: (100 + 160 + 140) ÷ 3 ≈ 133.33. 120 is the mean of all five days.

More Operations, Supply Chain & Business Analytics questions

Exams that ask this topic