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
ExperiencesCoaching
New
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
Start free
Rolling Average Claims by Adjuster
00:00
5 left

Rolling Average Claims by Adjuster

MediumSQL · PostgreSQL

Problem

Write a SQL query using window functions to find the rolling 30-day average of claims processed per adjuster at Sedgwick.

Use the provided claims and adjusters data. Include only claims with a processed status and a non-null processing date. Calculate the average of each adjuster's daily processed-claim counts over the current date and preceding 29 calendar days.

Output

  1. One row per adjuster and date with at least one processed claim.
  2. Columns: adjuster_id, adjuster_name, processed_date, claims_processed, and rolling_30_day_avg.
  3. Order by adjuster_id, then processed_date ascending.

Output details

  • Round rolling_30_day_avg to exactly 2 decimal places.
  • Average only the represented qualifying dates within the 30-day range; do not treat missing dates as zero-count days.
  • Count non-null claim_id values without deduplicating duplicate IDs.

Schema

adjusters
ColumnTypeDescription
adjuster_idPKINTUnique identifier for the adjuster
adjuster_nameVARCHAR(100)Full name of the adjuster
team_nameVARCHAR(100)Adjuster team or operating group
claims
ColumnTypeDescription
claim_idPKINTUnique identifier for the claim
adjuster_idINTAdjuster assigned to the claim
processed_dateDATEDate the claim was processed
statusVARCHAR(30)Current claim processing status
Tablesadjustersclaims
Interviewer

Whenever you're ready, walk me through your approach or go straight to the code. The requirements and the two tables are in the Question tab.

Sign up free to run or submit. Log in
CodePostgreSQL
Sign up free to run your code. Your draft is saved.Run with a free accountLog inLn 1
Run your query to see results here.