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

Across DBs that support it, what does this query compute for each row?

SELECT id, val, val - LAG(val, 1, 0) OVER (ORDER BY id) AS diff FROM readings;