Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Customers With Several Open Loans

A loan is open when payments are less than its principal. Return customers with more than one open loan, and how many.

Table schema

Loans(id INT PRIMARY KEY, customer VARCHAR(10), principal INT, annual_rate INT, months INT)
Payments(loan_id INT, amount INT, paid_on DATE)

Sample data

Loans
id | customer | principal | annual_rate | months
1 | Ann | 1000 | 12 | 6
2 | Bob | 2000 | 10 | 12
3 | Ann | 500 | 8 | 3
4 | Bob | 300 | 5 | 3

Payments
loan_id | amount | paid_on
1 | 400 | 2026-02-01
1 | 600 | 2026-03-01
2 | 500 | 2026-02-05
2 | 500 | 2026-03-05

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.