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).
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.