Calculate the year-over-year growth in total account balances opened per year. For each year, compute the total balance of accounts opened that year and the growth rate compared to the previous year. Return the year, yearly_total, prev_year_total, and growth_pct (rounded to 2 decimals). Use LAG window function. Order by year ascending.
Schema
🔑idINT
🔗customer_idINT
account_typeTEXT
balanceREAL
currencyTEXT
opened_atTEXT
statusTEXT
postgresql
Run your query to see results
Press Ctrl + Enter to execute