Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
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 feedbackSuccess 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
Running Total and Customer Ranking
00:00
5 left

Running Total and Customer Ranking

MediumSQL · PostgreSQL

Problem

Mutual of Omaha's claims analytics team needs a regional view of paid claim activity. Write a PostgreSQL query that aggregates paid claims per policyholder, calculates a regional running total, and ranks policyholders within each region.

Requirements

  1. Include only claims with claim_status = 'Paid' and policyholders with at least one non-null claim amount.
  2. Calculate each policyholder's total paid claims.
  3. Calculate a running total within each region, ordered by total paid claims descending and policyholder_id ascending as a tie-breaker.
  4. Rank policyholders within each region by total paid claims descending. Tied totals must receive the same rank.

Schema

policyholders
ColumnTypeDescription
policyholder_idPKINTUnique policyholder identifier
policyholder_nameVARCHAR(100)Policyholder name
regionVARCHAR(30)Geographic servicing region
claims
ColumnTypeDescription
claim_idPKINTUnique claim identifier
policyholder_idINTReferenced policyholder identifier
claim_dateDATEDate the claim was recorded
claim_amountDECIMAL(12,2)Claim amount
claim_statusVARCHAR(20)Claim processing status
Tablespolicyholdersclaims
Interviewer

Your question is Running Total and Customer Ranking. Start with the requirements and the two 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
Sign up free to run your codeLog inLn 1
Run your query to see results here.