AnalystPath

Year-over-Year Revenue Growth

SQLMediumMid levelAmazon~15 min

Problem

**[Commonly asked at Amazon, Lyft]**

Given a table of monthly revenue, calculate the **year-over-year growth rate** for
each month — how the revenue changed compared to the same month in the prior year.

Growth rate = `(current_revenue - prior_revenue) / prior_revenue * 100`

Months with no prior-year data should be excluded.
Return `revenue_month`, `current_revenue`, and `yoy_pct` (rounded to 2 dp), ordered by month.

Tables

Example rows — the live problem includes the full dataset.

monthly_rev
rev_idrevenue_month--

Expected output

Your answer should return 6 rows with the columns revenue_month, current_revenue, yoy_pct.

Starter code (SQL)

SELECT *
FROM monthly_rev;

Solve this SQL question free

Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.

Solution & explanation

Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.

Sign up free to unlock

Related SQL questions