{"id":29311459,"url":"https://github.com/susshiii/sql-layoffs-data-cleaning-and-eda","last_synced_at":"2025-07-07T08:14:50.960Z","repository":{"id":302316328,"uuid":"1012013834","full_name":"Susshiii/SQL-Layoffs-Data-Cleaning-and-EDA","owner":"Susshiii","description":"Full SQL project using MySQL to clean and analyze a real-world tech layoff dataset from 2020–2023.","archived":false,"fork":false,"pushed_at":"2025-07-01T17:24:33.000Z","size":64,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-01T18:26:03.121Z","etag":null,"topics":["data-analysis","data-analytics-project","data-cleaning","eda","layoffs","mysql","sql"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Susshiii.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-01T17:12:29.000Z","updated_at":"2025-07-01T17:26:52.000Z","dependencies_parsed_at":"2025-07-01T18:38:50.220Z","dependency_job_id":null,"html_url":"https://github.com/Susshiii/SQL-Layoffs-Data-Cleaning-and-EDA","commit_stats":null,"previous_names":["susshiii/sql-data-cleaning-project"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Susshiii/SQL-Layoffs-Data-Cleaning-and-EDA","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Susshiii%2FSQL-Layoffs-Data-Cleaning-and-EDA","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Susshiii%2FSQL-Layoffs-Data-Cleaning-and-EDA/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Susshiii%2FSQL-Layoffs-Data-Cleaning-and-EDA/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Susshiii%2FSQL-Layoffs-Data-Cleaning-and-EDA/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Susshiii","download_url":"https://codeload.github.com/Susshiii/SQL-Layoffs-Data-Cleaning-and-EDA/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Susshiii%2FSQL-Layoffs-Data-Cleaning-and-EDA/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264040975,"owners_count":23548077,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-analysis","data-analytics-project","data-cleaning","eda","layoffs","mysql","sql"],"created_at":"2025-07-07T08:14:50.013Z","updated_at":"2025-07-07T08:14:50.944Z","avatar_url":"https://github.com/Susshiii.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# 📊 Layoffs Data Cleaning \u0026 Exploratory Data Analysis using SQL\n\nThis project demonstrates a full SQL-based data analytics workflow: starting from **cleaning raw layoff data** and ending with **exploratory data analysis (EDA)** to extract meaningful business insights. The dataset was taken from the [Alex The Analyst Data Analyst Bootcamp](https://www.youtube.com/@AlexTheAnalyst).\n\n---\n\n## 📁 Dataset Information\n\n- **Name:** layoffs.csv\n- **Source:** GitHub (via Alex The Analyst Bootcamp)\n- **Content:** Layoffs from global tech companies during 2020–2023\n- **Columns include:**\n  - Company, Location, Industry\n  - Total Laid Off, % Laid Off\n  - Date of Layoff\n  - Company Stage (e.g., Series A, Series C)\n  - Country, Funding Raised\n\n[Layoffs Dataset on GitHub](https://github.com/AlexTheAnalyst/MySQL-YouTube-Series/blob/main/layoffs.csv)\n\n---\n\n## 🛠 Tools \u0026 Skills Used\n\n| Tool | Purpose |\n|------|---------|\n| **MySQL** | SQL scripting, transformations, and analysis |\n| **SQL Techniques** | `CTEs`, `ROW_NUMBER`, `GROUP BY`, `JOINS`, `CASE`, `TRIM`, `REPLACE`, `DATE FORMATTING`, `WINDOW FUNCTIONS`, `DENSE_RANK` |\n\n---\n\n## 🔧 Phase 1: Data Cleaning (`DATA_CLEANING_PROJECT.sql`)\n\n### ✅ Cleaning Objectives:\n1. **Remove duplicates** using `ROW_NUMBER()` in a CTE\n2. **Standardize inconsistent entries** like:\n   - Company names (trim extra spaces)\n   - Industry names (e.g., 'Crypto/Blockchain' → 'Crypto')\n   - Country names (e.g., remove trailing '.' in 'United States.')\n3. **Fix date formatting** using `STR_TO_DATE()`\n4. **Handle missing values** by:\n   - Replacing empty strings with `NULL`\n   - Updating NULLs using inferred data from other rows\n5. **Delete irrelevant records**\n   - Rows with both `total_laid_off` and `percentage_laid_off` as NULL\n6. **Drop helper columns** like `row_num` after cleaning\n\n### 🧹 Key Queries Used:\n```sql\n-- Assign row numbers to detect duplicates\nROW_NUMBER() OVER (\n  PARTITION BY company, location, industry, total_laid_off, percentage_laid_off, date, stage, country, funds_raised_millions\n)\n\n-- Trim company names\nUPDATE layoffs_staging2\nSET company = TRIM(company);\n\n-- Format date column\nUPDATE layoffs_staging2\nSET date = STR_TO_DATE(date, '%m/%d/%Y');\n\n-- Drop extra column\nALTER TABLE layoffs_staging2\nDROP COLUMN row_num;\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsusshiii%2Fsql-layoffs-data-cleaning-and-eda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsusshiii%2Fsql-layoffs-data-cleaning-and-eda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsusshiii%2Fsql-layoffs-data-cleaning-and-eda/lists"}