Missed minimum payments

aggregations

Missed minimum payments

Capital One SQL Interview Question

Capital One's collections team contacts customers who repeatedly pay less than the minimum amount due on their card statement.

Find every customer who paid less than the minimum due in 2 or more months. Show the customer_name and the number of those months as missed_payments.

Asked of

  • Data Analyst
  • Business Analyst
  • Data Scientist
  • ML Engineer

statementsTable18 rows

Column NameType
statement_idBIGINT
account_idBIGINT
statement_monthDATE
balanceDOUBLE
minimum_dueDOUBLE
amount_paidDOUBLE

accountsTable8 rows

Column NameType
account_idBIGINT
customer_nameVARCHAR
productVARCHAR
credit_limitBIGINT
opened_dateDATE

statementsExample Input

statement_idaccount_idstatement_monthbalanceminimum_dueamount_paid
16012024-04-0112003535
26022024-04-012400602400
36042024-04-0113504020
56012024-05-0118504545
66022024-05-01310075500
76042024-05-012100550
96012024-06-0122505560
106022024-06-012900702900
116042024-06-0126406565

accountsExample Input

account_idcustomer_nameproductcredit_limitopened_date
601Jordan LeeCredit Card50002021-03-15
602Aisha KhanCredit Card120002019-08-02
603Mateo GarciaSavingsNULL2020-11-20
604Emily ChenCredit Card30002022-06-10

Example Output

customer_namemissed_payments
Emily Chen2

Explanation

Emily Chen paid 20 against a minimum of 40 in April and 0 against 55 in May. In June, the payment was exactly the minimum of 65, which is not less than the minimum, so June does not count. That gives 2 missed payments.

The example above is a small slice of the data. Your query runs against the full tables.