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
Claims Reporting Data Modeling
00:00
5 left

Claims Reporting Data Modeling

HardSQL · PostgreSQL

Problem

How do you design a data model for a complex MetLife insurance claims reporting system to optimize both write performance and read query speeds?

For the supplied relational model, write a PostgreSQL query that produces a monthly claims report for claims opened during the first quarter of 2024. The report must use the latest available claim status and include payment and closure metrics.

Output

  1. One row per line of business and claim month, ordered by line of business and month.
  2. Return line_of_business, claim_month, claim_count, total_paid, average_days_to_close, prior_month_claim_count, and cumulative_paid.
  3. Include claims without events or payments, treating missing payments as zero. Claims outside the quarter are excluded.

Schema

policies
ColumnTypeDescription
policy_idPKINTUnique policy identifier
policy_numberVARCHAR(20)Business policy number
line_of_businessVARCHAR(40)Insurance product line
claims
ColumnTypeDescription
claim_idPKINTUnique claim identifier
policy_idINTPolicy associated with the claim
claim_typeVARCHAR(30)Claim classification
opened_atDATEDate the claim was opened
claim_events
ColumnTypeDescription
event_idPKINTUnique event identifier
claim_idINTClaim associated with the event
statusVARCHAR(20)Status recorded by the event
event_tsTIMESTAMPTimestamp of the status event
claim_payments
ColumnTypeDescription
payment_idPKINTUnique payment identifier
claim_idINTClaim associated with the payment
amountNUMERIC(12,2)Payment amount
Tablespoliciesclaimsclaim_eventsclaim_payments
Interviewer

Your question is Claims Reporting Data Modeling. Start with the requirements and the four 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.