Given a table of user betting logs, write a query to identify consecutive losing streaks exceeding a specific threshold for risk assessment.
Assume the threshold is more than 3 consecutive losing bets. A win or a missing result ends the current losing streak.
user_id, streak_start, streak_end, and losing_bets.user_id, then streak_start, then streak_end.| Column | Type | Description |
|---|---|---|
| bet_idPK | INT | Unique identifier for the bet |
| user_id | INT | Identifier of the bet365 user |
| bet_timestamp | TIMESTAMP | Time when the bet was settled |
| outcome | VARCHAR(20) | Bet result, such as loss, win, or void |
| stake | NUMERIC(10,2) | Amount staked on the bet |