Describe a time you used SQL to solve a complex data issue.
For this exercise, use the supplied shift, assignment, and payment tables to demonstrate a reconciliation query. Identify completed assignments where the recorded payment differs from the expected payment, including missing payment records.
Output
- One row per completed assignment with a payment discrepancy.
- Columns:
assignment_id, worker_id, shift_date, expected_payment, recorded_payment, and discrepancy.
- Treat a missing payment as zero, order by
shift_date ascending and assignment_id ascending.