SUM(amount) OVER (PARTITION BY account ORDER BY day) is used as a running total. Which frame does the default produce?
Correct answer
A. RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW, which also includes rows tied on day
17 views
A. RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW, which also includes rows tied on day
17 views
Window frames default to RANGE UNBOUNDED PRECEDING TO CURRENT ROW whenever ORDER BY is present, so rows sharing a day value are included together and a running total can jump at ties. Specifying ROWS BETWEEN ... CURRENT ROW gives one increment per physical row instead. Without ORDER BY the frame covers the whole partition, so the same SUM becomes a grand total.
Asked in: NTS, PPSC IT, Interviews
Not sure why the answer is A? Ask here and get an explanation.