This project involves a comprehensive exploratory data analysis (EDA) of global COVID-19 data, with a deep-dive focus on the impact within Kenya. Using SQL, I analyzed datasets covering deaths and vaccinations to uncover trends in infection rates, mortality percentages, and the progress of vaccination rollouts.
COVID-19 Data Exploration (SQL)
📌 Project Overview
This project involves a comprehensive exploratory data analysis (EDA) of global COVID-19 data, with a deep-dive focus on the impact within Kenya. Using SQL, I analyzed datasets covering deaths and vaccinations to uncover trends in infection rates, mortality percentages, and the progress of vaccination rollouts.
The data spans from January 2020 to February 27, 2023, sourced from Our World in Data.
🛠️ Tools & Tech Stack
Language: SQL (Microsoft SQL Server)
Concepts Used: Joins, CTE's, Temp Tables, Windows Functions, Aggregate Functions, Creating Views, Converting Data Types.
Data Source: Our World in Data (CSV format).
📊 Key Analysis Points
The SQL script is structured to answer several critical questions:
Death Likelihood: What is the probability of dying if you contract COVID-19 in Kenya versus other parts of the world?
Infection Density: What percentage of the Kenyan population has been infected?
Global Rankings: Which countries and continents have the highest death counts and infection rates relative to their population?
Vaccination Progress: A rolling calculation of total vaccinations administered globally and the percentage of the population vaccinated.
🚀 SQL Techniques Showcased
1. Data Transformation & Cleaning
I utilized CAST and CONVERT to ensure numerical data (originally imported as strings) was treated as integers or decimals for accurate mathematical calculations.
SQL
-- Converting varchar to int for calculation
Select location, max(cast(total_deaths as int)) as TotalDeathCount
From PortfolioProject..[COVID Deaths]
Group by location
2. Advanced Calculations with CTEs
To calculate the rolling percentage of people vaccinated, I used a Common Table Expression (CTE) to perform calculations on a column created via a Windows Function.
SQL
With PopVsVac (continent, location, date, population, new_vaccinations, TotalVaccinations)
as (
-- Query logic including Partition By
)
Select *, (TotalVaccinatio …