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
Policy Update Cascades in SQL
00:00
5 left

Policy Update Cascades in SQL

MediumSQL · PostgreSQL

Problem

Write a SQL query to verify that a specific policy update correctly cascaded to the claims database. Use update_id = 1002 as the specific update. Compare eligible claims with the policy update and its audit records, identifying missing applications, mismatched limits, and stale references.

Output

  1. One row for update 1002
  2. Columns: update_id, policy_id, expected_claim_count, cascaded_claim_count, missing_audit_count, mismatched_limit_count, stale_reference_count, cascade_status
  3. Return PASS only when all eligible claims were correctly updated and audited; otherwise return FAIL.

Schema

policy_updates
ColumnTypeDescription
update_idPKINTUnique policy update identifier
policy_idINTPolicy affected by the update
old_coverage_limitNUMERIC(12,2)Coverage limit before the update
new_coverage_limitNUMERIC(12,2)Coverage limit expected after the update
updated_atTIMESTAMPTime the policy update became effective
statusVARCHAR(20)Policy update processing status
claims
ColumnTypeDescription
claim_idINTBusiness identifier for the claim
claim_versionINTVersion number for the claim
policy_idINTPolicy associated with the claim
claim_created_atTIMESTAMPClaim creation timestamp
claim_updated_atTIMESTAMPClaim version update timestamp
claim_statusVARCHAR(20)Current claim status
coverage_limitNUMERIC(12,2)Coverage limit stored on the claim
policy_update_idINTPolicy update applied to the claim
claim_update_audit
ColumnTypeDescription
audit_idPKINTUnique audit record identifier
claim_idINTClaim affected by the update
policy_update_idINTPolicy update recorded by the audit event
applied_atTIMESTAMPTime the cascade was recorded
source_systemVARCHAR(30)System that recorded the audit event
Tablespolicy_updatesclaimsclaim_update_audit
Interviewer

Your question is Policy Update Cascades in SQL. 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.