Write a SQL query using window functions to calculate the moving average of robot idle times over a rolling 24-hour period at Amazon Robotics.
Use completed idle events only. Ignore rows with a NULL idle_start or idle_end.
event_id, robot_id, idle_start, idle_seconds, and moving_avg_idle_seconds.robot_id, idle_start, and event_id ascending.| Column | Type | Description |
|---|---|---|
| event_idPK | INTEGER | Unique idle event identifier |
| robot_id | VARCHAR(20) | Amazon Robotics robot identifier |
| idle_start | TIMESTAMPTZ | Start timestamp of the idle interval |
| idle_end | TIMESTAMPTZ | End timestamp of the idle interval |