Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Top Billing Providers Query
00:00
5 left

Top Billing Providers Query

MediumSQL · PostgreSQL

Problem

Write a query to find the top three highest-billing insurance providers for a specific diagnostic test over the last quarter at Natera.

Use the Panorama test and the previous calendar quarter relative to the query date. Exclude voided claims and records outside the quarter.

Output

  1. One row per selected insurance provider with provider_id, provider_name, total_billed, and billing_rank.
  2. Return exactly the three highest-billing providers, ordered by billing_rank, then provider_name.

Schema

insurance_providers
ColumnTypeDescription
provider_idPKINTUnique insurance provider identifier
provider_nameVARCHAR(100)Insurance provider name
payer_typeVARCHAR(30)Provider classification
diagnostic_tests
ColumnTypeDescription
test_idPKINTUnique diagnostic test identifier
test_codeVARCHAR(30)Diagnostic test code
test_nameVARCHAR(100)Diagnostic test name
test_billing
ColumnTypeDescription
billing_idPKINTUnique billing record identifier
provider_idINTReferenced insurance provider
test_idINTReferenced diagnostic test
billed_amountDECIMAL(12,2)Amount billed for the claim
billed_atDATEDate the billing record was submitted
claim_statusVARCHAR(20)Claim processing status
Tablesinsurance_providersdiagnostic_teststest_billing
Interviewer

Your question is Top Billing Providers Query. 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.