Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Top Providers by Claim Volume

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

Your question is Top Providers by Claim 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

HiLabs CareAlign needs a regional view of provider activity based on processed claims. Write a PostgreSQL query that identifies the top three healthcare providers by claim volume within each region.

Requirements

  1. Join providers to regions and claims using their key relationships.
  2. Count only claims with claim_status = 'Processed'.
  3. Aggregate claim volume by region and provider, then rank providers within each region using a window function.
  4. Return only the top three providers per region, ordering ties by provider_id.

Schema

regions
ColumnTypeDescription
region_idPKINTUnique region identifier
region_nameVARCHAR(50)Name of the geographic region
providers
ColumnTypeDescription
provider_idPKINTUnique healthcare provider identifier
provider_nameVARCHAR(100)Healthcare provider name
region_idINTReferences regions.region_id
claims
ColumnTypeDescription
claim_idPKINTUnique claim identifier
provider_idINTReferences providers.provider_id
claim_statusVARCHAR(20)Current claim processing status
Tablesregionsprovidersclaims
Your solutionPostgreSQL
You need to log in / sign up to run or submit.
Run a query to see results