SELECT
    strftime('%Y-%m', e.occurred_on) AS month,
    COUNT(*) AS safety_events,
    SUM(e.safety_cost) AS total_safety_cost,
    AVG(e.safety_cost) AS avg_safety_cost
FROM events e
WHERE e.safety_cost > 0
  AND e.occurred_on IS NOT NULL
GROUP BY month
ORDER BY month;