Users with Three Transactions in Sixty Seconds
Problem statement
Return every user who has any three transactions occurring within an inclusive 60-second window.
For each user's chronologically ordered transactions, a qualifying window exists when the third transaction is at most 60 seconds after the first.
Table schema
MySQLPostgreSQLPandas
Use the same input data with any supported language. Open the Schema tab in the editor to see the generated SQL setup or Pandas DataFrames.
transactions
| Column | Type | Nullable | Description |
|---|---|---|---|
| transaction_idPK | Integer | No | — |
| user_id | Integer | No | — |
| transaction_time | Timestamp | No | — |
Expected result
Your query or function must return these columns.
| Column | Type | Nullable | Description |
|---|---|---|---|
| user_id | Integer | No | — |
Row order: must match exactly. Numeric tolerance: 0.
Constraints
- Order equal timestamps by transaction ID.
- Return each qualifying user once.
- Sort user IDs ascending.