A data cleaning project using MySQL that takes raw tech layoffs data and transforms it into a clean, analysis-ready dataset through a structured staging pipeline.
This project demonstrates real-world SQL data cleaning techniques applied to a dataset of tech company layoffs. The goal is to remove duplicates, standardize values, handle null/blank fields, and prepare the data for exploratory data analysis (EDA).
| File | Description |
|---|---|
layoffs.csv |
Raw source data — tech layoffs dataset |
cleaned.csv |
Final cleaned and processed output |
protifolio.sql |
Full SQL data cleaning pipeline |
layoffs.csv
│
└──► layoffs (raw table)
│
└──► layoffs_staging (duplicate detection)
│
└──► layoffs_staging2 (cleaning & standardization)
│
└──► cleaned.csv (final output)
- Duplicate Removal — Used
ROW_NUMBER()withPARTITION BYto identify and delete duplicate records - Standardization
- Trimmed whitespace from company names
- Unified industry labels (e.g.,
crypto,Crypto Currency→Crypto) - Fixed country names (e.g.,
United States.→United States)
- Date Formatting — Converted text dates to proper
DATEtype usingSTR_TO_DATE() - Null & Blank Handling — Filled in missing industry values via self-join; removed rows with no usable data
- Schema Cleanup — Dropped helper columns (
row_num) after use
- Database: MySQL
- Language: SQL
- Techniques: CTEs, Window Functions, Self Joins, String Functions, Type Casting
The dataset contains records of tech company layoffs including:
- Company name & location
- Industry & stage
- Total laid off & percentage laid off
- Date & funds raised (millions)
- Import
layoffs.csvinto MySQL as thelayoffstable - Run
protifolio.sqlsequentially to execute the full cleaning pipeline - The final cleaned data will be in the
layoffs_staging2table (also exported ascleaned.csv)
Portfolio project by Rohith Sunkari