Finance wants to track revenue momentum. Using the orders table, return month, revenue, prev_revenue (previous month's revenue), and growth_pct ((revenue − prev_revenue) / prev_revenue × 100, rounded to 2 decimal places), ordered by month. The first month should show NULL for prev_revenue and growth_pct.
orders
| column | type |
|---|---|
| id | INTEGER |
| customer_id | INTEGER |
| amount | NUMERIC |
| created_at | DATE |
| id | customer_id | amount | created_at |
|---|---|---|---|
| 1 | 1 | 400.00 | 2024-01-05 |
| 2 | 2 | 600.00 | 2024-01-20 |
| 3 | 1 | 500.00 | 2024-02-10 |
| 4 | 3 | 700.00 | 2024-02-25 |
| 5 | 2 | 300.00 | 2024-03-08 |
| 6 | 1 | 600.00 | 2024-03-22 |
| month | revenue | prev_revenue | growth_pct |
|---|---|---|---|
| 2024-01-01 | 1000.00 | NULL | NULL |
| 2024-02-01 | 1200.00 | 1000.00 | 20.00 |
| 2024-03-01 | 900.00 | 1200.00 | -25.00 |
January has no prior month, so prev_revenue and growth_pct are NULL. February revenue grew from 1000 to 1200 (+20%). March dropped from 1200 to 900 (−25%).