| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
A practical MySQL data-cleaning project focused on preparing a real-world layoffs dataset for reliable analysis.
This project demonstrates an end-to-end SQL data-cleaning workflow using MySQL. The raw layoffs dataset was inspected, staged, cleaned, standardized, and prepared for downstream analysis.
The project focuses on data quality rather than exploratory analysis, with particular attention to duplicate records, inconsistent text values, date formatting, missing values, and records without meaningful layoff information.
The raw dataset contains 2,361 records and 9 columns:
A staging table was created with the same structure as the original table. The raw data was then copied into the staging table so the original dataset remained unchanged.
ROW_NUMBER() with PARTITION BY was used across the dataset columns to identify duplicate records.
The raw dataset contained 5 duplicate records, which were removed from the staging table.
Several inconsistent text values were cleaned:
The original date values were stored as text. They were converted using:
The final column was converted to the MySQL DATE data type.
Blank industry values were converted to NULL.
A self-JOIN was then used to populate missing industry values when another record for the same company contained a valid industry.
Records where both total_laid_off and percentage_laid_off were NULL were removed because they did not contain meaningful layoff information.
This removed 361 records after duplicate removal.
The temporary row_num column used for duplicate detection was removed from the final staging table.
| Stage | Records |
|---|---|
| Raw dataset | 2,361 |
| Duplicate records removed | 5 |
| After duplicate removal | 2,356 |
| Records with both layoff measures missing | 361 |
| Final cleaned dataset | 1,995 |
The final dataset is substantially cleaner and better suited for further SQL analysis, visualization, or dashboard development.
sql-data-cleaning-project/
├── data/
│ └── layoffs_raw.csv
├── docs/
│ └── linkedin_project.md
├── sql/
│ └── data_cleaning.sql
├── .gitignore
└── README.md
The SQL script is intentionally kept as a separate file so the cleaning process can be reviewed step by step.
This project demonstrates practical skills in:
SQL • MySQL • Data Cleaning • Data Transformation • Data Quality • CTEs • Window Functions • Data Validation • Missing-Value Handling • Duplicate Detection
The cleaned dataset can be used for a follow-up exploratory data analysis project, such as analyzing layoffs by company, industry, country, funding stage, date, and percentage of workforce affected.
| Back | FazBrowse Home | New Git URL |