If you were handed two different but related sets of data, what tools would you use to find the matches? What if all you had was SQL SELECT access to a database? In this practical book, author Jim Lehmer provides best practices, techniques, and tricks to help you import, clean, match, score, and think about heterogeneous data using SQL.
DBAs, programmers, business analysts, and data scientists will learn how to identify and remove duplicates, parse strings, extract data from XML and JSON, generate SQL using SQL, regularize data and prepare datasets, and apply data quality and ETL approaches for finding the similarities and differences between various expressions of the same data.
Full of real-world techniques, the examples in the book contain working code. You'll learn how to:
Identity and remove duplicates in two different datasets using SQL
Regularize data and achieve data quality using SQL
Extract data from XML and JSON
Generate SQL using SQL to increase your productivity
Prepare datasets for import, merging, and better analysis using SQL
Report results using SQL
Apply data quality and ETL approaches to finding similarities and differences between various expressions of the same data
AI Reading Assistant
Whole-book reading guide from stratified index samples; jump to passages in the text
Tip the Site
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat Pay
Alipay
Open WeChat or Alipay and scan. No login required.
AI guide
【One-Line Pitch】
A practical SQL-first guide to reconciling messy, heterogeneous datasets when all you have is SELECT access—ideal for DBAs, analysts, and data engineers who must deduplicate, clean, and match records without leaving the database.
【Book Arc】
- **Opening (~0%–10%)**: Frames the core problem—two related datasets, no shared key, only SQL—and lays out the book's workflow: import, clean, match, score, report. A quick SELECT/join review (Chapter 1) refreshes the patterns used throughout.
- **Early (~10%–32%)**: Builds the SQL toolkit (Chapter 2): date, logical, string, and system functions (CHARINDEX, PATINDEX, TRIM, REPLACE, COALESCE, ISDATE, IIF) that later chapters lean on heavily for parsing and normalization.
- **Middle (~32%–55%)**: Tackles common dirty-data domains one by one—names (Chapter 3), locations/addresses (Chapter 4), dates (Chapter 5), email (Chapter 6), phone numbers (Chapter 7), and bad characters/encoding (Chapter 8)—showing how to regularize each before matching.
- **Late (~55%–80%)**: Moves into matching itself: extracting data from XML/JSON, generating SQL with SQL, preparing datasets for import and merge, and applying data-quality/ETL thinking to find similarities and differences between expressions of the same entity.
- **Ending (~80%–100%)**: Focuses on scoring, reporting results, and operationalizing the workflow—turning candidate matches into reviewable output and production-ready views. (Excerpts do not cover the final chapters in detail.)
【Key Takeaways】
- **Fuzzy matching is a pipeline, not a single query** (Opening): import → clean → match → score → report; each stage has its own SQL techniques and failure modes.
- **Normalization must precede matching** (Early–Middle): names, addresses, dates, emails, and phones each carry domain-specific traps—suffixes, punctuation, future birthdates, invalid emails, embedded annotations like "Aunt Judy's #".
- **String functions are the workhorses** (Early): CHARINDEX, PATINDEX, LEFT/RIGHT/SUBSTRING, TRIM, REPLACE, and TRANSLATE combine to parse and regularize free-text fields.
- **COALESCE and outer joins solve "most current value" problems** (Early): when a loan amount lives across four tables in three systems, COALESCE picks the first non-NULL value across joined sources.
- **NULL semantics and collation matter** (Early): ANSI_NULLS behavior, EXISTS vs. joins, and case-sensitive collations can silently break matches; choose COLLATE deliberately.
- **Bad characters and encoding are real match-killers** (Middle): nonbreaking spaces, invisible characters, and charset mismatches survive TRIM and corrupt comparisons.
- **Generate SQL with SQL to scale** (Late): meta-programming queries boosts productivity when matching rules must be applied across many columns or tables.
- **Scoring and reporting close the loop** (Late–Ending): match confidence must be surfaced for human review, not just computed.
【Reading Tips】
- **Skim Part I if you know SQL well**—the author says so explicitly; jump to Chapter 2's function reference and return as needed.
- **Deep-read Chapters 3–8** (names, locations, dates, email, phone, bad characters); these are the domain-specific heart of the book and where most real-world pain lives.
- **Run the code**: examples are working SQL, and the parsing logic (e.g., splitting "Mortimer Snedley, Jr.") is best understood by executing and modifying it.
- **Adopt the CTE-to-view pattern** the author uses during EDA—prototype with CTEs, promote to views for production.
- **Treat the author's opinions as a starting point**, not gospel; he explicitly invites you to compare approaches and synthesize your own.
【Coverage Limits】
This guide is based on stratified excerpts covering roughly the first half of the book; the later matching, scoring, and reporting chapters are referenced but not detailed in the source material.
Excerpt 1
36 ISDATE 37 Logical Functions: IIF 37 String Functions 38 CHARINDEX and PATINDEX 38 LEN 39 LEFT, RIGHT, and SUBSTRING 39 LTRIM, RTRIM, and TRIM 46 LOWER and...
eferring to a SQL or other programming language keyword, it will look like COUNT(*). Block SQL code in the text appears as follows: SELECT * FROM sys.databas...
ations, these are different tables in dif‐ ferent databases. Then perhaps the loan origination system moves the loan from the application phase to underwriti...
ead of LOWER and UPPER because it forces some other charac‐ ter representation issues into a uniform representation and not just whether all char‐ acters are...
isn’t a precise business. Don’t let that make you a victim! “That list from Marketing” (clears throat) “doesn’t have everything I need, but I can construct m...
o share an email address, and that happens, but it is rare). Along with mobile phone numbers, if you have a match on email, your likelihood of a false positi...
insensitive, accent-sensitive, kanatype-insensitive, width- insensitive for Unicode Data, SQL Server Sort Order 52 on Code Page 1252 for non- Unicode Data.”...
Support this siteYour recognition and a small knowledge-service contribution help keep this technical work open source.
Scan the WeChat Pay or Alipay code below. Logged-in and guest visitors can both tip.
WeChat PayAlipay
Open WeChat or Alipay and scan. No login required.
Add Tag
Enter tag name (max 50 characters)
Share E-Book
Fuzzy Data Matching with SQL Enhancing Data Quality and Query Performance (Jim Lehmer) (Z-Library)
Scan QR code with your phone to access
Copy the link or scan the QR code to access this e-book on your phone
Share E-Book via Email
Please enter email address
Donation Statistics
¥.00
Total Donations
0
Donation Count
Fuzzy Data Matching with SQL Enhancing Data Quality and Query Performance (Jim Lehmer) (Z-Library)
Find Your Favorite Books
Only registered users can comment after logging in. Comments need to be reviewed by administrators before being displayed
Loading comments...
Reply to Comment
Edit Comment