Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumSQLwindow functions ROW_NUMBER RANKSingle-choice MCQ

Over the column v with values 10, 10, 20, the two queries below compute a running total. What totals does the first row with v=10 versus the second row with v=10 get from the default-frame version, and how does that differ from the ROWS version?

SELECT v, sum(v) OVER (ORDER BY v) AS default_frame, sum(v) OVER (ORDER BY v ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS rows_frame FROM (VALUES (10),(10),(20)) t(v);