Write a SQL query to identify users who have had more than three failed transaction attempts followed by a successful one within a 10-minute window at Sift.
Use the users and transaction_attempts tables. Return each qualifying user once, using their earliest qualifying successful transaction.
user_id, successful_attempt_id, successful_at, and failed_attempt_countuser_id ascending, then successful_attempt_id ascending| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique Sift user identifier |
| VARCHAR(255) | User email address |
| Column | Type | Description |
|---|---|---|
| attempt_idPK | INT | Unique transaction attempt identifier |
| user_id | INT | User associated with the attempt |
| status | VARCHAR(20) | Attempt outcome, such as failed or success |
| attempted_at | TIMESTAMPTZ | Timestamp when the attempt occurred |