Новосибирск, debit: spend above avg x1.5, Feb–Nov 2025
Instructions
For each account and calendar month, compute the total spending spent: the sum of -amount over transactions with amount < 0 whose tx_time is on or after February 1, 2025 and strictly before December 1, 2025 (months in which an account has no spending are not considered). An account's average monthly spending is the average of spent over its considered months. For accounts of type 'debit' in currency 'RUB' of clients from the city 'Новосибирск' (clients.city), output account_id, month (the first day of the month) and spent for the months in which spent is strictly greater than the same account's average monthly spending, multiplied by 1.5. Row order does not matter.
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.