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
Rolling Average Processing Times
00:00
5 left

Rolling Average Processing Times

MediumSQL · PostgreSQL

Problem

Guidewire ClaimCenter analysts want to monitor how claim processing times change over time. Write a PostgreSQL query that calculates a three-claim rolling average for completed claims, grouped by claim type.

Requirements

  1. Join claims to policyholders and include only claims with a matching policyholder and status = 'Closed'.
  2. Calculate processing_days as the number of calendar days between opened_date and closed_date.
  3. Calculate the average processing time for the current claim and the two preceding closed claims of the same claim_type, ordered by closed_date and claim_id.
  4. Return the claim number, claim type, region, closed date, processing days, and rolling average, rounded to two decimal places. Sort by claim type and closed date.

Schema

claims
ColumnTypeDescription
claim_idPKINTPrimary key for the claim
claim_numberVARCHAR(20)ClaimCenter claim identifier
policyholder_idINTReferences policyholders.policyholder_id
claim_typeVARCHAR(30)Claim classification
statusVARCHAR(20)Current claim status
opened_dateDATEDate the claim was opened
closed_dateDATEDate the claim was closed
policyholders
ColumnTypeDescription
policyholder_idPKINTPrimary key for the policyholder
policyholder_nameVARCHAR(100)Policyholder full name
regionVARCHAR(30)Policyholder region
Tablesclaimspolicyholders
Interviewer

Your question is Rolling Average Processing Times. 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.