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
SQL Query for Expected Results
00:00
5 left

SQL Query for Expected Results

MediumSQL · PostgreSQL

Problem

Guidewire PolicyCenter needs an operational summary of active policies and their 2025 claims. Write a PostgreSQL query that produces one row per qualifying policy, including policies with no matching claims.

Requirements

  1. Include only policies with status = 'ACTIVE' and an effective_date on or before December 31, 2025.
  2. Count claims reported during calendar year 2025.
  3. Sum only COMPLETED claim payments, showing zero when no completed payment exists.
  4. Sort by policy_number ascending. Use a CTE to aggregate payments before joining, preventing claim payment rows from inflating claim counts.

Schema

policycenter_policies
ColumnTypeDescription
policy_idPKINTPrimary policy identifier
policy_numberVARCHAR(20)Guidewire PolicyCenter policy number
insured_nameVARCHAR(100)Named insured
statusVARCHAR(20)Current policy status
product_lineVARCHAR(40)Policy product line
effective_dateDATEPolicy effective date
claims
ColumnTypeDescription
claim_idPKINTPrimary claim identifier
policy_idINTRelated policy identifier
reported_dateDATEDate the claim was reported
statusVARCHAR(20)Claim lifecycle status
claim_payments
ColumnTypeDescription
payment_idPKINTPrimary payment identifier
claim_idINTRelated claim identifier
amountNUMERIC(12,2)Payment amount
payment_statusVARCHAR(20)Payment processing status
Tablespolicycenter_policiesclaimsclaim_payments
Interviewer

Your question is SQL Query for Expected Results. Start with the requirements and the three 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.