TEC-DATA86-07 · Lesson 6 · 12 clock hours · practice
Master Data Management and Duplicate Resolution
Objective. Students will apply MDM concepts to identify, score, and resolve duplicate customer records across two source systems using deterministic and probabilistic matching techniques in SQL.
⚠ Pending professional review
This lesson, its worked examples and its practice questions has not yet been verified by an industry-certified professional or by a certification or approval body. It is a study draft and may contain errors. Do not use it as instructions for work on a job site or on live equipment. Always follow your instructor, your supervising professional, and current official references and regulations.
VoTechWorks program approval and accreditation are still in progress. Credentials are issued only by the certifying bodies named in each program, after their own exams.
What Is Master Data Management?
Master Data Management (MDM) is the discipline of creating and maintaining a single, authoritative, trusted version of key business entities — customers, products, vendors, locations — across an organization's systems. When the same customer exists in a CRM, a billing platform, and a support ticketing system under slightly different names or addresses, every downstream report, mailing, and analysis is contaminated. MDM resolves that fragmentation by producing a golden record: one canonical row that represents the true entity, built by merging the best attributes from all source copies.
MDM is a core topic in the DAMA DMBOK and is tested on the CDMP Associate exam. It also appears in Oracle and Microsoft DP-300 contexts wherever data integration and quality are discussed.
Duplicate Records: Why They Exist
Duplicates arise from multiple entry points (web sign-up vs. call-center entry), inconsistent data standards ("St." vs. "Street"), human keying errors, and system migrations that lack deduplication steps. A customer named "Jon Smith" entered in System A and "Jonathan Smith" entered in System B may be the same person. Detecting that match requires logic beyond a simple primary-key join.
Blocking: Narrowing the Search Space
Comparing every row in Table A against every row in Table B produces a Cartesian product. For two tables of 5,000 rows each, that is 25 million pairs — expensive and slow. Blocking groups records by a shared key so that comparisons happen only within blocks. Common blocking keys include:
- First three characters of last name
- ZIP code or postal area
- Soundex or metaphone code of first name
- First digit of phone number
Blocking trades completeness for performance. You must choose blocking keys that are unlikely to separate true matches.
Deterministic Matching
Deterministic (rules-based) matching declares a match when specific fields are identical. Example: two records are a match if email address AND date of birth are equal. It is fast and auditable but brittle — one typo breaks the match.
Probabilistic Matching
Probabilistic matching assigns a similarity score to each field and combines scores into an overall match weight. PostgreSQL supports this through the pg_trgm extension, which computes trigram similarity (a value from 0.0 to 1.0) between two strings. The Levenshtein distance function (also available via `fuzzystrmatch`) counts the minimum single-character edits needed to transform one string into another; smaller distances indicate closer matches.
Enable the extensions once per database:
```sql
CREATE EXTENSION IF NOT EXISTS pg_trgm;
CREATE EXTENSION IF NOT EXISTS fuzzystrmatch;
```
Weighted Scoring Rubric
A weighted rubric assigns a maximum point value to each field and multiplies it by the normalized similarity score for that field. A typical four-field rubric for customer records:
| Field | Max Points | Similarity Function |
|---------|------------|-----------------------------|
| Name | 35 | pg_trgm similarity |
| Address | 25 | pg_trgm similarity |
| Phone | 20 | Exact or partial match |
| Email | 20 | Exact or trigram similarity |
Total score = sum of weighted field scores (0–100). Classification thresholds:
- 80–100: Match — merge automatically
- 50–79: Possible Match — route to human review
- 0–49: Non-Match — discard pair
Thresholds must be calibrated against your data; these are starting points, not universal rules.
Survivor Rules and the Golden Record
Once duplicates are confirmed, you must decide which source value wins for each attribute. A survivor rule is a documented policy. Common policies:
- Most recent update wins: the attribute from whichever record has the later `updated_at` timestamp is kept.
- Most complete wins: a non-null value beats a null value.
- Trusted source wins: System A is authoritative for billing address; System B for email.
In today's lab the policy is: most recently updated record wins for each attribute independently. Apply it field by field, not record by record — a golden record may assemble its name from System A and its address from System B.
Document every survivor rule in the data dictionary: what the rule is, why it was chosen, and when it was last reviewed. Without documentation, future maintainers cannot reproduce or audit your merge logic.
Building the Golden-Record Table
The golden-record target table must have a surrogate key (e.g., `golden_id`) and a `source_keys` column or separate linkage table that maps back to the originating system IDs. This linkage is essential for downstream reconciliation and audit trails.
After loading, verify:
```sql
SELECT COUNT(*), COUNT(DISTINCT golden_id) FROM golden_customer;
```
If both counts are equal, there are zero duplicate keys. This is a required pass criterion today.
Data Safety and Professional Responsibility
This lesson works with synthetic data, but in production environments customer records are personally identifiable information (PII). Treat them accordingly:
- Never copy production PII to a laptop or unencrypted external drive.
- Apply role-based access controls so only authorized users can read the match table.
- Log all merge operations — who ran them, when, and what changed.
- Confirm your organization's data retention and deletion policies before merging; GDPR and state privacy laws may impose obligations.
These are professional, not optional, responsibilities. Mishandling PII can result in regulatory penalties and harm to individuals.
Checklist Before You Submit
1. Match table generated by SQL with no syntax errors.
2. Scoring rubric applied to all candidate pairs (Match / Possible Match / Non-Match column populated).
3. Golden-record table passes the zero-duplicate-key check.
4. Merge logic documented in the data dictionary template.
Key terms10
Master Data Management (MDM)The processes, policies, and tools used to define and maintain a single authoritative version of core business entities (customers, products, etc.) across multiple systems.
Golden RecordThe single, trusted, merged representation of an entity produced by MDM, combining the best attributes from all duplicate source records.
BlockingA technique that groups records by a shared key attribute before comparison, reducing the number of candidate pairs that must be evaluated.
Deterministic MatchingA matching strategy that declares records identical when one or more specified fields are an exact match; fast and auditable but sensitive to data-entry errors.
Probabilistic MatchingA matching strategy that computes a numerical similarity score across multiple fields and classifies pairs based on total weighted score rather than exact equality.
Trigram SimilarityA string-comparison measure (0.0–1.0) provided by PostgreSQL's pg_trgm extension; it compares the overlap of consecutive three-character substrings between two strings.
Levenshtein DistanceThe minimum number of single-character insertions, deletions, or substitutions required to change one string into another; smaller values indicate more similar strings.
Survivor RuleA documented policy that determines which source record's attribute value is retained when duplicate records are merged into a golden record.
Candidate PairA pair of records from two source tables that has passed blocking and is being evaluated to determine whether the two records represent the same real-world entity.
Data DictionaryA repository that defines each data element's name, data type, meaning, source, and any business rules or transformation logic applied to it, including merge and survivor rules.
Worked examples4
1. Calculate the weighted match score for a candidate pair where: name trigram similarity = 0.82, address trigram similarity = 0.60, phone is an exact match, and email trigram similarity = 0.45. Use the rubric: Name 35 pts, Address 25 pts, Phone 20 pts, Email 20 pts.
- Name score: 35 × 0.82 = 28.70 points
- Address score: 25 × 0.60 = 15.00 points
- Phone score: exact match counts as similarity 1.0, so 20 × 1.0 = 20.00 points
- Email score: 20 × 0.45 = 9.00 points
- Total score: 28.70 + 15.00 + 20.00 + 9.00 = 72.70 points
- Classify: 72.70 falls in the 50–79 range → Possible Match; route to human review.
Answer: Total weighted score = 72.70 → classified as Possible Match.
2. A blocking strategy groups records by the first three characters of last name. Source A has 5,000 rows and Source B has 5,000 rows. Without blocking, how many candidate pairs exist? If blocking reduces comparisons to an average of 12 rows in Source A and 11 rows in Source B per block, and there are 420 blocks, how many candidate pairs remain after blocking?
- Unblocked pairs: 5,000 × 5,000 = 25,000,000 candidate pairs.
- Blocked pairs: each block contributes 12 × 11 = 132 pairs.
- Total blocked pairs: 420 blocks × 132 pairs per block = 55,440 candidate pairs.
- Reduction: 55,440 vs. 25,000,000 — blocking cut the workload by more than 99.7%.
Answer: Without blocking: 25,000,000 pairs. After blocking: 55,440 pairs.
3. Apply a survivor rule of 'most recently updated attribute wins' to merge two duplicate records field by field. Record A: first_name='Jon', last_name='Smith', email='jon@example.com', updated_at='2023-03-15'. Record B: first_name='Jonathan', last_name='Smith', email='j.smith@example.com', updated_at='2023-11-02'. Which values appear in the golden record?
- Compare updated_at timestamps: Record A = 2023-03-15; Record B = 2023-11-02. Record B is more recent overall, but the rule applies per attribute, so we check each field independently.
- first_name: Record B's updated_at (2023-11-02) is later → use 'Jonathan'.
- last_name: Both records have 'Smith' and the same value — either record wins; use 'Smith'.
- email: Record B's updated_at (2023-11-02) is later → use 'j.smith@example.com'.
- Because all attributes in Record B share the same updated_at and it is the later timestamp, every attribute comes from Record B.
- Golden record: first_name='Jonathan', last_name='Smith', email='j.smith@example.com'.
Answer: Golden record: first_name='Jonathan', last_name='Smith', email='j.smith@example.com' (all from Record B, the more recently updated record).
4. You have 8,200 candidate pairs after blocking. After scoring, 1,640 score 80–100 (Match), 2,460 score 50–79 (Possible Match), and the remainder score below 50 (Non-Match). What percentage of pairs are classified as Possible Match and require human review?
- Total pairs: 8,200.
- Possible Match count: 2,460.
- Percentage: (2,460 ÷ 8,200) × 100 = 30.0%.
- Confirm Non-Match count: 8,200 − 1,640 − 2,460 = 4,100 Non-Match pairs (sanity check).
Answer: 30.0% of candidate pairs (2,460 of 8,200) are classified as Possible Match and require human review.
The math in this lesson1
Learners compute a weighted match score from field weights times similarity scores.
A-SSE.1
In class: Load two provided customer extract tables (each ~5,000 rows) into PostgreSQL; write SQL using string functions, Levenshtein distance (pg_trgm extension), and blocking keys to generate a candidate-pairs match table. · Apply a weighted scoring rubric (name, address, phone, email) to each candidate pair and classify pairs as Match, Possible Match, or Non-Match; manually review and adjudicate a 50-row sample. · Merge confirmed duplicates into a golden-record target table using a survivor-rule policy (most recently updated record wins for each attribute) and document the merge logic in the data dictionary.
Materials: PostgreSQL 15 with pg_trgm extension, DBeaver CE, provided synthetic dual-source customer CSVs, MDM scoring rubric template, DAMA DMBOK MDM chapter
Check: Match table generated by SQL with no syntax errors; scoring rubric applied to all candidate pairs; golden-record table has zero duplicate keys; merge logic is documented — all four criteria must be met to pass.
Practice check8
Answer each question, then check it. Nothing is recorded; this is your own practice.
Record this lesson on my transcript. Sign in with your key and enrollment email to record lessons (enroll free if you have no key). This page stays open to read and practise.