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
SQL for Duplicate Records
00:00
5 left

SQL for Duplicate Records

EasySQL · PostgreSQL

Problem

Principal Financial Group uses claims data for operational reporting and quality checks. Write a PostgreSQL query to identify duplicate non-void claims received during 2025.

A claim is considered a duplicate when multiple records share the same member_id, claim_date, provider_code, and claim_amount. Exclude rows with a null provider_code, but retain claims whose claim_status is null. Include member details when available, without removing duplicate claims for an unmatched member.

Requirements

  1. Group claims by the four business-key columns and retain only groups containing at least two records.
  2. Return one row per duplicate business-key group, including the duplicate count.
  3. Use a LEFT JOIN to add the member name, and sort by claim date and member ID.

Schema

claims
ColumnTypeDescription
claim_idPKINTEGERUnique claim record identifier
member_idINTEGERPrincipal member identifier
claim_dateDATEDate the claim was submitted
provider_codeVARCHAR(20)Billing provider code
claim_amountNUMERIC(10,2)Submitted claim amount
claim_statusVARCHAR(20)Claim processing status
members
ColumnTypeDescription
member_idPKINTEGERUnique Principal member identifier
member_nameVARCHAR(100)Member's full name
plan_nameVARCHAR(80)Principal insurance plan name
Tablesclaimsmembers
Interviewer

Your question is SQL for Duplicate Records. 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.