Your question is SQL Joins and Date Aggregation. Start with the requirements and the three 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.
Agile Defense's mission support dashboard needs a daily summary of operational events across missions and monitored systems. Write a PostgreSQL query that joins mission events to their mission and system records, then aggregates the results by event date and mission.
LEFT JOIN for systems so events remain visible when a system record is unavailable. Treat a missing impact score as zero.| Column | Type | Description |
|---|---|---|
| mission_idPK | INTEGER | Primary key for a mission |
| mission_code | VARCHAR(20) | Short mission identifier |
| mission_name | VARCHAR(100) | Mission display name |
| Column | Type | Description |
|---|---|---|
| event_idPK | INTEGER | Primary key for an event |
| mission_id | INTEGER | References missions.mission_id |
| system_id | INTEGER | References systems.system_id when available |
| event_recorded_at | TIMESTAMP | Timestamp when the event was recorded |
| status | VARCHAR(20) | Current event status |
| impact_score | INTEGER | Numeric impact score |
| Column | Type | Description |
|---|---|---|
| system_idPK | INTEGER | Primary key for a monitored system |
| system_name | VARCHAR(100) | System display name |
| system_category | VARCHAR(50) | System classification |