Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Top Clients by Volume Last 30 Days
00:00
5 left

Top Clients by Volume Last 30 Days

MediumSQL · PostgreSQL

Problem

Write a query to find the top 5 clients by total transaction volume in the last 30 days, including their total asset value.

Use the provided client, transaction, and asset tables. Treat the last 30 days relative to CURRENT_DATE; clients without a matching asset record should still be eligible.

Output

  1. One row per qualifying client with client_id, client_name, total_transaction_volume, and total_asset_value
  2. Include the five highest transaction volumes, ordered descending, with client_id ascending as the tie-breaker

Schema

clients
ColumnTypeDescription
client_idPKINTUnique client identifier
client_nameVARCHAR(100)Client display name
transactions
ColumnTypeDescription
transaction_idPKINTUnique transaction identifier
client_idINTClient associated with the transaction
transaction_dateDATEDate the transaction occurred
transaction_amountNUMERIC(14,2)Transaction amount
client_assets
ColumnTypeDescription
asset_record_idPKINTUnique asset record identifier
client_idINTClient who owns the assets
asset_valueNUMERIC(16,2)Value represented by the asset record
Tablesclientstransactionsclient_assets
Interviewer

Your question is Top Clients by Volume Last 30 Days. Start with the requirements and the three 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.