Dataford
Interview QuestionsInterview GuidesExperiencesCoaching
New
Pricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackCoaching1:1 coaching with people at your target companiesSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan

Build a SQL Question From Script

MediumSQL & Data Manipulation00:00
Practice interviewer
In session
5 left
00:00

Your question is Build a SQL Question From Script. Take a moment with it on the right.

Talk me through your thinking if you like. When you're confident, submit your answer and I'll grade it like a real screen (7/10 or better passes).

You need to log in / sign up to chat or submit.

Problem

Evernorth Health Services' network operations team uses a claims analytics pipeline to flag providers whose reimbursement patterns look unusual compared to their peers. You are handed the query below, pulled straight from that pipeline with the real table and column names intact.

-- claims(claim_id, member_id, provider_id, service_date, paid_amount, claim_status)
-- providers(provider_id, specialty, network_tier)
-- members(member_id, plan_type, state)

SELECT
    p.provider_id,
    p.specialty,
    COUNT(DISTINCT c.claim_id) AS claim_count,
    ROUND(AVG(c.paid_amount), 2) AS avg_paid_amount,
    ROUND(SUM(c.paid_amount), 2) AS total_paid_amount
FROM claims c
JOIN providers p ON p.provider_id = c.provider_id
JOIN members m ON m.member_id = c.member_id
WHERE c.claim_status = 'PAID'
  AND c.service_date >= DATE '2025-01-01'
  AND m.plan_type = 'PPO'
GROUP BY p.provider_id, p.specialty
HAVING COUNT(DISTINCT c.claim_id) >= 25
   AND AVG(c.paid_amount) > (
        SELECT AVG(paid_amount) * 1.5
        FROM claims
        WHERE claim_status = 'PAID'
   )
ORDER BY avg_paid_amount DESC;

Walk through the query in your own words and explain what business question it is answering. Cover what each join attaches, what the filters are narrowing down to, and what the final HAVING condition is actually selecting for.