Balance of account 1040 at 1.5% per month from January 2025
Instructions
Model a savings account from the transactions of the account with account_id = 1040 over 6 months: from January 1, 2025 to the end of the month that starts on June 1, 2025. The balance before the first month is 0. In each month interest is applied first: the balance at the end of the previous month is multiplied by 1.015 (1.5% per month, also when the balance is negative), then flow is added, the sum of amount over all transactions of this account in the month (signed; 0 if there were none). Output month (the first day of the month, type date), flow and balance (the balance at the end of the month, rounded to 2 decimal places; round only the result, not the intermediate balances). Sort by month ascending.
Hints
Each next one is more detailed and costs more
Query
Result
Click Run to see the query result, or Check to submit your solution.
Dataset schema
Table relationships
- N:1Many-to-one
accounts.→client_id clients.id - N:1Many-to-one
transactions.→account_id accounts.id
Table data
Select a table in the diagram or list to view its rows.