Skip to content
RED SAGSkills
medium10 pts · first answer countssqlwindow-functions

Day-over-day change with LAG

daily has revenue 100 on 03-01, 130 on 03-02 and 90 on 03-03. What does the query return, in date order?

SELECT d, revenue - LAG(revenue) OVER (ORDER BY d) AS change
FROM daily ORDER BY d;
Choose one answer