top of page

US Household Data Cleaning Project- MySQL

  • benlusic
  • Mar 20
  • 1 min read

Updated: Jun 11





In this project we walk through the process used for cleaning the raw household data.


Link to GitHub


Background: Received raw household data from a client and needed to transform and clean the data to be used in a Web Application.


Process: Used MySQL to ingest the data, identified data inconsistencies, and normalized the data using processes shown below.


First, let's take a look at the data:


A MySQL query result grid showing the raw, uncleaned household dataset with unformatted columns, visible duplicate records, and inconsistent text entries.

 We need to check for duplicates first. Let's do this by running a count on the id which should be unique.


A MySQL code snippet utilizing a COUNT function and GROUP BY clause on the unique ID column to identify duplicate entries in the household dataset.

With this code we can see we have multiple duplicates. We need to remove these duplicates and we do that with this code:


A MySQL script demonstrating the logic used to delete duplicate rows from the table while retaining only the unique master records.

All the duplicates have been removed in the data.


Next, the data needs to be standardized and uniform:

A MySQL UPDATE script using string functions to standardize formatting, trim whitespace, and unify data types across the dataset columns.

We also found the data was inconsistent and was mis-labeled, misspelled, or not clear.

Found it here...


A database query result highlighting inconsistent and misspelled values within a specific column before data cleaning.

And here...

A MySQL CASE statement query used to find, map, and overwrite mislabeled data fields with clear, standardized terms.

Then end result is the data is cleaned and ready to be used. No misspelling or duplicates.


The final, cleaned MySQL database table grid showing zero duplicates, perfectly uniform formatting, and fully corrected spelling across all household records.



 
 
 

Comments


bottom of page