Skip to main content
All Problems
medium0% acceptance

Average Days Between Loan Payments

For each loan that has at least 2 payments, calculate the average number of days between consecutive payments. Return loan_id, payment_count, and avg_days_between (rounded to 1 decimal). Use the difference between the earliest and latest payment dates divided by (payment_count - 1). Order by avg_days_between ascending.

Schema

🔑idINT
🔗loan_idINT
payment_dateTEXT
amountREAL
principal_paidREAL
interest_paidREAL
remaining_balanceREAL
postgresql

Run your query to see results

Press Ctrl + Enter to execute