CTE with Window Function for Running Comparison
Hard
ctes
Google
Databricks
Snowflake
Write a query using a CTE to calculate monthly revenue and then use a window function to compare each month to the previous month. Return month, revenue, prev_revenue, and growth (revenue - prev_revenue), ordered by month.
Expected Output: Monthly revenue with month-over-month growth.
Tables
Hints (3 available)
SQL Editor
Output
Click "Run" to see results...