Write a SQL query to track equipment accountability by comparing government-furnished equipment checkouts, returns, and missing items across multiple exercise dates.
Use the supplied exercise, equipment, and transaction data. Treat an item as missing when it was checked out for an exercise but has not been returned for that exercise.
Output
- One row per exercise date, including dates with no transactions.
- Columns:
exercise_date, exercise_name, checked_out_count, returned_count, missing_count, and missing_equipment_codes.
- Show missing equipment codes as a comma-separated, alphabetically ordered string, or an empty string when none are missing.
- Order by
exercise_date ascending.