ERM Digital stores environmental, health, safety, and regulatory obligations across client facilities. Write a PostgreSQL query that produces an operational extract of active compliance records requiring attention by June 30, 2025.
Requirements
- Return records with status
Open or Overdue whose due date is on or before June 30, 2025, or whose due date is missing.
- Use a
LEFT JOIN so records remain visible when their facility or facility attributes are missing.
- Replace missing facility names, regions, responsible people, and due dates with readable labels. Classify each record as
Overdue, Due by cutoff, or Missing due date.
- Order records by due date ascending, placing records without due dates last.