Given a table of robot telemetry events and a table of maintenance logs, find the top three most frequent error codes that occur within 15 minutes prior to a hardware shutdown at Amazon Robotics.
Write a PostgreSQL query. Include events exactly 15 minutes before shutdowns, exclude events at or after shutdown time, and ignore telemetry rows without an error code.
error_code and frequencyfrequency descending, then error_code ascending| Column | Type | Description |
|---|---|---|
| event_idPK | INT | Unique telemetry event identifier |
| robot_id | VARCHAR(20) | Identifier of the robot that emitted the event |
| event_timestamp | TIMESTAMP | Time when the telemetry event occurred |
| error_code | VARCHAR(40) | Telemetry error code, when present |
| Column | Type | Description |
|---|---|---|
| maintenance_idPK | INT | Unique maintenance log identifier |
| robot_id | VARCHAR(20) | Identifier of the affected robot |
| maintenance_type | VARCHAR(40) | Type of maintenance activity |
| shutdown_timestamp | TIMESTAMP | Time of the hardware shutdown, when applicable |