Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Top Commercial Clients by Loan Volume

EasySQL · PostgreSQL00:00
Practice interviewer
In session
5 left
00:00

Your question is Top Commercial Clients by Loan Volume. Start with the requirements and the three tables on the right.

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.

Problem

You are given commercial lending data and asked to write a SQL query that returns the top 5 commercial clients by total loan volume, excluding any client marked with a high-risk flag. Use the client-level risk status to filter out ineligible clients, then aggregate funded loan amounts across each remaining client.

Schema

clients
ColumnTypeDescription
client_idPKINTUnique identifier for each client
client_nameVARCHAR(100)Commercial or retail client name
client_typeVARCHAR(30)Client segment such as Commercial or Retail
client_risk_flags
ColumnTypeDescription
client_idINTReferences the client
high_risk_flagBOOLEANWhether the client is currently marked high risk
review_dateDATEDate of the risk review
loans
ColumnTypeDescription
loan_idPKINTUnique identifier for each loan
client_idINTReferences the borrowing client
loan_amountDECIMAL(14,2)Funded or requested loan amount
loan_statusVARCHAR(30)Loan status such as Funded, Pending, or Cancelled
Tablesclientsclient_risk_flagsloans
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results