Year over Year Growth

Hard
ctes

Given a revenue table with year and amount, write a query using a CTE and the LAG() window function to calculate the year-over-year growth percentage.

Return columns year, amount, prev_amount, and growth_pct (rounded to 2 decimal places). The first year should have NULL for prev_amount and growth_pct. Order by year.

Tables

Hints (3 available)

SQL Editor

Output

Click "Run" to see results...