Date arithmetic across two TEXT date columns
SOX control — find posted entries where the gap between `txn_date` and `posted_date` is more than 15 days. Columns: `txn_id`, `txn_date`, `posted_date`, `days_late`. Sort by days_late DESC.
Each hint you reveal reduces the XP you can earn. Try the query first.
Cast both columns to date: `posted_date::date - txn_date::date` gives days as an integer in Postgres.
Filter `posted = 1` AND the gap > 15.
Watch out for the one malformed MM/DD/YYYY row and any NULL posted_date — filter them out so the cast doesn't error.