medium10 pts · first answer countssqlwindow-functions
Month-over-month change with LAG
Monthly revenue is Jan 100, Feb 120, Mar 90. What does the change column show for the three months?
SELECT month,
revenue - LAG(revenue) OVER (ORDER BY month) AS change
FROM monthly_revenue;