Your question is Top Contributors to Diagnostic Trouble Codes. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
General Motors needs to identify vehicle models contributing the most diagnostic trouble codes in a large sensor database. Write a PostgreSQL query that aggregates diagnostic events for January 2024 and returns the top three models.
| Column | Type | Description |
|---|---|---|
| vehicle_idPK | INT | Unique vehicle identifier |
| model | VARCHAR(80) | General Motors vehicle model |
| Column | Type | Description |
|---|---|---|
| event_idPK | INT | Unique diagnostic event identifier |
| vehicle_id | INT | Vehicle associated with the event |
| dtc_code | VARCHAR(20) | Diagnostic trouble code |
| severity | VARCHAR(20) | Diagnostic event severity |
| event_timestamp | TIMESTAMP | Timestamp when the event was recorded |