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

Detect Duplicate Records in SQL

MediumSQL · PostgreSQL

Problem

Finacle transaction ingestion can receive the same banking transaction more than once from core banking, ATM, or mobile channels. Write a PostgreSQL query to identify duplicate active records in finacle_transaction_ingest.

Requirements

  1. Treat records as duplicates when customer_id, txn_reference, txn_date, amount, currency, and transaction_type match. A NULL reference must match another NULL reference.
  2. Include only records with processing_status of POSTED or PENDING; exclude reversed records.
  3. Return every duplicate record, its duplicate count, the customer name when available, and sort deterministically by customer, reference, date, and transaction ID.

Schema

finacle_transaction_ingest
ColumnTypeDescription
transaction_idPKBIGINTUnique ingested transaction record ID
customer_idVARCHAR(20)Finacle customer identifier
txn_referenceVARCHAR(40)Source transaction reference
txn_dateDATEBanking transaction date
amountNUMERIC(14,2)Transaction amount
currencyVARCHAR(3)ISO currency code
transaction_typeVARCHAR(20)Debit or credit
processing_statusVARCHAR(20)Processing state
source_systemVARCHAR(20)Originating channel or system
finacle_customers
ColumnTypeDescription
customer_idPKVARCHAR(20)Finacle customer identifier
customer_nameVARCHAR(120)Customer display name
segmentVARCHAR(30)Customer segment
Tablesfinacle_transaction_ingestfinacle_customers
Interviewer

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