American Credit Acceptance wants to identify the average original loan principal for customers whose payment records show no missed payments during the most recent six-month review period. Assume the reporting date is July 1, 2024, so the review period runs from January 1 through June 30, 2024.
Write a PostgreSQL query that returns the average loan amount for loans belonging to qualifying customers.
Requirements
- Evaluate only payment due dates from January 1 through June 30, 2024.
- Treat a customer as qualified only when they have at least one payment in the period and every reviewed payment has a
payment_status of PAID.
- Exclude customers with
MISSED, LATE, or NULL payment statuses.
- Return one value named
average_loan_amount, rounded to two decimal places.