Your question is Find Unapplied Cash Payments. Start with the requirements and the two tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
You are given payment activity and account master data. Write a PostgreSQL query that returns all unapplied cash payments — payments that were received but were not matched to an account — along with the payment details needed for reconciliation. Include payments with a missing account_id as well as payments whose account_id does not exist in the accounts table.
| Column | Type | Description |
|---|---|---|
| payment_idPK | INT | Primary key for each payment |
| account_id | INT | Referenced account identifier, may be missing for unapplied cash |
| payment_date | DATE | Date the payment was received |
| payment_amount | DECIMAL(12,2) | Payment amount |
| payment_method | VARCHAR(50) | Method used for the payment |
| Column | Type | Description |
|---|---|---|
| account_idPK | INT | Primary key for each account |
| account_name | VARCHAR(100) | Account name |
| status | VARCHAR(20) | Account status |