Open USD accounts aged 3+ months on June 30, 2025
Instructions
Consider accounts in currency 'USD' (accounts.currency) that had not yet been closed on June 30, 2025 (closed_at is empty or strictly later than that date). An account's age on that date is the number of full months between opened_at and that date (age(June 30, 2025, opened_at): years * 12 + months). Keep accounts aged at least 3 months (so accounts opened after that date drop out). Group by account type (accounts.type) and output type, accounts_cnt, the number of accounts, avg_months, the average age in months (rounded to 1 decimal place), and max_months, the greatest age. 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.