Skip to content

An EDA project using MySQL to analyze layoff trends, identifying patterns across industries, countries, and company stages, with insights into major layoffs and impacted sectors.

Notifications You must be signed in to change notification settings

busesimsek/SQL-Exploratory-Data-Analysis-Project

Repository files navigation

Exploratory Data Analysis (EDA) of Layoffs

Table of Contents

  1. Project Overview
  2. Dataset
  3. SQL Queries
  4. Methodology
  5. Outputs
  6. Key Findings
  7. Conclusion
  8. Future Work
  9. How to Use This Project
  10. Contact

Project Overview

This project performs an exploratory data analysis (EDA) on a dataset containing layoff information from various companies using MySQL. The dataset includes details on layoffs across different industries, countries, and years, starting from March 11, 2020, through November 22, 2024. The purpose of this analysis is to uncover trends, patterns, and insights related to layoffs over time.


Dataset

The dataset used in this project is a cleaned version of layoff data, which was processed in my previous project:

🔗 Data Cleaning for Layoffs

The cleaned dataset is available in this repository as:

📄 cleaned_data_for_EDA.csv

The dataset used in this project is named layoffs_staging2, which contains information about layoffs such as:

  • Company name
  • Industry
  • Country
  • Date of layoff
  • Number of employees laid off (total_laid_off)
  • Percentage of employees laid off (percentage_laid_off)
  • Company stage (e.g., startup, post-IPO, etc.)

SQL Queries

The SQL queries used for this analysis are provided in the Exploratory Data Analysis for Layoffs.sql file within this repository. This file contains all the queries used to extract insights from the dataset, covering:

  • Aggregations: SUM, MAX, MIN
  • Grouping & Ordering: GROUP BY, ORDER BY
  • Ranking Functions: DENSE_RANK, RANK
  • Rolling Totals & Cumulative Sums
  • Common Table Expressions (CTEs)

Methodology

This analysis was conducted using MySQL queries, without the use of data visualization tools. The queries include:

  • Aggregations (SUM, MAX, MIN)
  • Grouping and ordering (GROUP BY, ORDER BY)
  • Window functions (DENSE_RANK for ranking companies by year)
  • CTEs (Common Table Expressions) for rolling totals and rankings

Outputs

The results of the SQL queries have been saved in the outputs folder of this repository. These files contain key insights derived from the analysis, including:

  1. Total Layoffs by Year – Breakdown of layoffs per year.
  2. Total Layoffs by Industry – Summarized layoffs across different industries.
  3. Total Layoffs by Country – Layoffs categorized by country.
  4. Total Layoffs by Date – Layoffs recorded on specific dates.
  5. Total Layoffs by Month Each Year – Layoffs aggregated by month within each year.
  6. Rolling Total by Each Month – Cumulative layoffs calculated per month.
  7. Total Layoffs by Stage – Analysis of layoffs based on company growth stage.
  8. Layoffs by Companies per Year – Company-wise layoffs reported each year.
  9. Ranking of Total Layoffs by Companies per Year – Companies ordered by total layoffs per year.
  10. Dense Rank of Layoffs by Companies per Year – Layoff rankings using a dense ranking method.
  11. Top 5 Companies per Year – The five companies with the highest layoffs each year.
  12. Largest Layoffs – Companies with the highest number of layoffs in a single event.
  13. Companies with Entire Workforce Laid Off – List of companies that laid off 100% of their employees.

These outputs provide a structured way to review key trends and insights found in the dataset.


Key Findings

Date Range of Layoff Data

  • The dataset includes layoffs from March 11, 2020, to November 22, 2024.

Largest Layoffs

  • The maximum number of employees laid off in one instance was 15,000.
  • The maximum percentage laid off was 100%, meaning some companies completely shut down.

Companies with Entire Workforce Laid Off

  • 288 companies had a 100% layoff rate.
  • The company with the largest total layoff in this category was Katerra (2,434 employees laid off).

Companies with the Highest Total Layoffs

Company Total Laid Off
Amazon 27,840
Meta 21,000
Intel 16,057
Microsoft 14,708
Tesla 14,500
Cisco 14,300
Google 13,472
Dell 12,650
Salesforce 11,140
SAP 11,000

Industries with the Highest Total Layoffs

Industry Total Laid Off
Retail 71,703
Consumer 71,046
Other 61,912
Transportation 60,548
Hardware 54,870

Countries with the Highest Total Layoffs

Country Total Laid Off
United States 455,331
India 56,469
Germany 28,572
United Kingdom 20,090
Netherlands 19,005

Dates with the Highest Total Layoffs

Date Total Laid Off
2023-01-04 16,171
2024-08-01 15,180
2022-11-16 14,926
2023-01-20 14,682
2024-04-15 14,000

Total Layoffs by Year

Year Total Laid Off
2024 149,006
2023 264,220
2022 164,319
2021 15,823
2020 80,998
  • 2023 saw the highest number of layoffs overall.
  • The high layoff numbers in 2020 may be due to COVID-19 lockdowns.

Layoffs by Company Stage

Stage Total Laid Off
Post-IPO 375,102
  • Post-IPO companies had the highest total layoffs.

Top Layoff Companies by Year

Year Company Total Laid Off
2020 Uber 7,525
2021 Bytedance 3,600
2022 Meta 11,000
2023 Amazon 17,260
2024 Intel 15,062

Conclusion

This EDA provides insights into layoff trends across industries, countries, and years, revealing significant events such as mass layoffs in large corporations and post-COVID-19 effects. The data suggests that layoffs peaked in 2023, with Amazon, Meta, and Intel being the most affected companies.


Future Work

  • Data Visualization: Using Tableau or Power BI to create charts and graphs for better insights.
  • Predictive Analysis: Applying machine learning techniques to forecast future layoffs.
  • Deeper Industry-Specific Analysis: Investigating layoffs based on business performance.

How to Use This Project

  1. Clone the repository to your local machine.
  2. Load the dataset into MySQL.
  3. Run the provided SQL queries in the Exploratory Data Analysis for Layoffs.sql file to explore the dataset.
  4. Review the outputs in the Outputs folder for key insights and trends.

Contact

For questions or feedback, feel free to reach out to me on GitHub or via email.

About

An EDA project using MySQL to analyze layoff trends, identifying patterns across industries, countries, and company stages, with insights into major layoffs and impacted sectors.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published