Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Delinquent Loans Query
00:00
5 left

Delinquent Loans Query

MediumSQL · PostgreSQL

Problem

Write a query to identify all mortgage loans that have been delinquent for more than 90 days at Cenlar FSB, including the borrower's payment history and the total outstanding principal balance.

Use the provided loan, borrower, loan account, and payment tables. Include loans without payment records, preserve payment chronology, and exclude loans at exactly 90 days delinquent or less.

Output

  1. One row per delinquent loan and payment record.
  2. Include loan_id, borrower details, delinquency days, payment details, prior payment date, payment status, and outstanding_principal_balance.
  3. Order by loan_id, payment_date, and payment_id.

Schema

mortgage_loans
ColumnTypeDescription
loan_idPKINTUnique mortgage loan identifier
borrower_idINTBorrower associated with the loan
current_delinquency_daysINTCurrent number of days the loan is delinquent
loan_statusVARCHAR(30)Current servicing status
borrowers
ColumnTypeDescription
borrower_idPKINTUnique borrower identifier
borrower_nameVARCHAR(100)Borrower's full name
borrower_stateVARCHAR(2)Two-letter borrower state code
loan_accounts
ColumnTypeDescription
loan_idPKINTMortgage loan identifier
original_principalNUMERIC(14,2)Original principal amount
outstanding_principal_balanceNUMERIC(14,2)Current unpaid principal balance
mortgage_payments
ColumnTypeDescription
payment_idPKINTUnique payment identifier
loan_idINTMortgage loan receiving the payment
payment_dateDATEDate the payment was recorded
payment_amountNUMERIC(12,2)Total payment amount
principal_paidNUMERIC(12,2)Amount applied to principal
payment_methodVARCHAR(30)Method used to submit payment
Tablesmortgage_loansborrowersloan_accountsmortgage_payments
Interviewer

Your question is Delinquent Loans Query. Start with the requirements and the four tables in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePostgreSQL
You need to log in / sign up to run or submit.Ln 1
Run your query to see results here.