Spending 20:00–23:00, all days, Sep–Nov 2025
Instructions
Consider debits (transactions.amount < 0) whose tx_time is on or after September 1, 2025 and strictly before December 1, 2025, made on any days and in the hours from 20 to 22 inclusive (the hour is taken from tx_time: for example, 12 is the interval from 12:00:00 to 12:59:59). Group by category and output category, tx_cnt, the number of debits, total_spent, the total of the debits as a positive number (minus the sum of amount), and avg_check, the average debit size as a positive number, rounded to 2 decimal places. 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.