Write a query to identify users who have executed more than four day trades within a rolling five-day window to flag potential pattern day traders on Robinhood.
Use the provided users and day_trades tables. Treat each row in day_trades as one completed day trade, and evaluate five calendar-day windows ending on a user's trade date.
user_id, username, window_start, window_end, and day_trade_count.user_id ascending.| Column | Type | Description |
|---|---|---|
| user_idPK | INT | Unique Robinhood user identifier |
| username | VARCHAR(100) | Robinhood username |
| account_status | VARCHAR(20) | Current account status |
| Column | Type | Description |
|---|---|---|
| trade_idPK | INT | Unique day trade identifier |
| user_id | INT | User who executed the trade |
| symbol | VARCHAR(10) | Traded security symbol |
| executed_at | TIMESTAMP | Timestamp when the day trade was executed |