The data in this repository is intended for use in understanding trends in company layoffs, performing data analysis, and generating reports.
The dataset contains the following columns:
- Company Name
- Location(city)
- Industry Type
- Total Layoff
- Percentage Layoffs
- Stage of Funding
- Country
- Funds Raised in Millions
SELECT TOP (10)
company,
total_laid_off
FROM layoff_staging_2
ORDER BY total_laid_off DESC;
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;
SELECT top 10
company,
percentage_laid_off
FROM layoff_staging_2
ORDER BY percentage_laid_off DESC;
SELECT stage,
SUM(total_laid_off) AS total_laid_off
FROM layoff_staging_2
GROUP BY stage
ORDER BY total_laid_off DESC;
SELECT
industry,
SUM(total_laid_off) AS total_laid_off
FROM
layoff_staging_2
GROUP BY
industry
ORDER BY
total_laid_off DESC;
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;
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;
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;
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;