Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

SQL Join for Top Client Accounts

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

Your question is SQL Join for Top Client Accounts. 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

Write a query to join three tables to find the top-performing client accounts based on monthly utilization hours at Interactive Process Technology.

Return the top three ranks for each month from January and February 2025. Ties should share a rank and remain included.

Output

  1. One row per ranked client account and month
  2. Columns: utilization_month, account_name, monthly_utilization_hours, and monthly_rank
  3. Include ranks through 3, ordered by month, rank, and account name

Schema

client_accounts
ColumnTypeDescription
account_idPKINTUnique client account identifier
account_nameVARCHAR(120)Client account name
account_statusVARCHAR(20)Current account status
projects
ColumnTypeDescription
project_idPKINTUnique project identifier
account_idINTClient account associated with the project
project_nameVARCHAR(120)Project name
project_statusVARCHAR(20)Current project status
utilization_records
ColumnTypeDescription
utilization_idPKINTUnique utilization record identifier
project_idINTProject associated with the utilization record
utilization_dateDATEDate on which hours were recorded
utilization_hoursDECIMAL(8,2)Hours recorded for the project
Tablesclient_accountsprojectsutilization_records
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results