-- Developed vs Developing SELECT Status, ROUND(AVG(Lifeexpectancy),1) AS avgLifeExp, ROUND(AVG(AdultMortality),1) AS avgAdultMort FROM worldlifexpectancy GROUP BY Status ORDER BY avgLifeExp DESC;
avg life expectancy (years)
avg adult mortality (per 1,000)
One of seven questions answered in MySQL, on the cleaned dataset.
01
World Life Expectancy — SQL analysis
View repository
SQL · 3 files
- Problem
- A 2,941-row global health dataset — 193 countries, 2007 to 2022 — with duplicate rows, missing Developed/Developing labels and gaps in life expectancy. Not usable as it stood.
- Work
- Cleaned it in MySQL:
ROW_NUMBERto find and remove 3 duplicates, a self join to fill 8 blank status labels, and adjacent-year interpolation for 2 missing values. Then answered seven questions with CTEs, window functions andCASE. - Result
- Global life expectancy rose from 66.8 to 71.6 years, with a clear 2020 dip. Developed countries average 79.2 years against 66.8, and less than half the adult mortality. Zimbabwe improved most, gaining 21 years.