4 largest transactions: Казань, premium, Jun–Nov 2025
Instructions
For each client from the city 'Казань' with the segment 'premium' output their 4 largest transactions by absolute amount: transactions (transactions) across all their accounts with tx_time on or after June 1, 2025 and strictly before December 1, 2025, both spending (amount < 0) and income (amount > 0); the larger |amount|, the larger the transaction; for equal |amount| take the transaction with the smaller id. If a client has fewer than 4 such transactions, output all of them; clients without transactions in this period are not in the result. Columns: client_id, name (the client's name), tx_id (the transaction id), amount (signed), category. 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.