Skip to content

SQL-based data analysis project examining layoffs during 2022-2023, with insights into industry trends, company impacts, and workforce dynamics.

Notifications You must be signed in to change notification settings

MoaviaMahmood/Data_analytics-with-sql-Layoffs_2022-2023

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Data Analytics of Layoffs between 2022-2023

Overview

The data in this repository is intended for use in understanding trends in company layoffs, performing data analysis, and generating reports.

Dataset Description

The dataset contains the following columns:

  1. Company Name
  2. Location(city)
  3. Industry Type
  4. Total Layoff
  5. Percentage Layoffs
  6. Stage of Funding
  7. Country
  8. Funds Raised in Millions

Data Analysis

Top 10 companies with the highest number of layoffs

SELECT TOP (10) 
   company, 
   total_laid_off
FROM layoff_staging_2
ORDER BY total_laid_off DESC;

01

Countries with the highest total number of layoffs

SELECT top 10
	country, 
	SUM(total_laid_off) AS total_layoffs
FROM layoff_staging_2
WHERE total_laid_off IS NOT NULL
GROUP BY country
ORDER BY total_layoffs DESC;

04

Companies have the highest percentage of employees laid off

SELECT top 10
       company,
       percentage_laid_off
FROM layoff_staging_2
ORDER BY percentage_laid_off DESC;

05

Total layoff per stage

SELECT stage,
   SUM(total_laid_off) AS total_laid_off
FROM layoff_staging_2
GROUP BY stage
ORDER BY total_laid_off DESC;

08

Total layoff per industry

SELECT 
    industry, 
    SUM(total_laid_off) AS total_laid_off
FROM 
    layoff_staging_2
GROUP BY 
    industry
ORDER BY 
    total_laid_off DESC;

09

What are the stages in the layoff process

SELECT DISTINCT stage, 
	COUNT(company) AS total_companies
FROM layoff_staging_2
where stage not like 'unknown'
GROUP BY stage
ORDER BY total_companies DESC;

07

Which companies have experienced the highest percentage of layoffs relative to their funds raised

SELECT top 10
    company, 
    total_laid_off, 
    round(percentage_laid_off,2) as percent_layoffs, 
    funds_raised_millions
FROM 
    layoff_staging_2
WHERE 
	total_laid_off is not null
	and percentage_laid_off is not null
	and funds_raised_millions is not null
ORDER BY 
    funds_raised_millions DESC;

06

Total Layoffs Per month

WITH MonthlyLayoffs AS (
    SELECT 
        DATENAME(MONTH, date) AS Months,
        SUM(Total_Laid_Off) AS Total_Laid_Off
    FROM 
        layoff_staging_2
    WHERE 
        Total_Laid_Off IS NOT NULL
    GROUP BY 
        DATENAME(MONTH, date)
)
SELECT 
    Months, 
    Total_Laid_Off
FROM 
    MonthlyLayoffs
ORDER BY 
    Total_Laid_Off DESC;

03

Top company in each industry with the highest number of layoffs

WITH RankedLayoffs AS (
    SELECT 
        Company, 
        Industry, 
        Total_Laid_Off,
        ROW_NUMBER() OVER (PARTITION BY Industry ORDER BY Total_Laid_Off DESC) AS Rank
    FROM 
        layoff_staging_2
    WHERE 
        Total_Laid_Off IS NOT NULL
)
SELECT 
    Company, 
    Industry, 
    Total_Laid_Off
FROM 
    RankedLayoffs
WHERE 
    Rank <= 1
ORDER BY 
    Industry, 
    Rank;

02

About

SQL-based data analysis project examining layoffs during 2022-2023, with insights into industry trends, company impacts, and workforce dynamics.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published