Data Exploration
For the analysis stage, use the analysis question as a guide throughout the analysis. After the analysis, three trends are determined:
- Total Cases vs Total Deaths in Malaysia
- Rate of Malaysia Population Decrease
- Percent Population Vaccinated
In order to find out the relationship of the trends, three SQL queries are created to aggregate data.
Total Cases vs Total Deaths in Malaysia
SQL Query:
SELECT SUM(cast(total_cases as decimal)) AS Total_Case_Malaysia, SUM(cast(total_deaths as decimal)) AS Total_Deaths_Malaysia
,(SUM(cast(total_deaths as decimal))/SUM(cast(total_cases as decimal))) * 100 AS Malaysia_DeathPercentage
FROM covid19_death$
WHERE iso_code like ‘%M%’ and location = ‘Malaysia’
Observations:
- Malaysia have 671,417,690 total cases and 6,728,847 total deaths.
Rate of Malaysia Population Decrease
SQL Query:
SELECT (cast(total_deaths as decimal)/cast(population as decimal)) * 100 AS Population_Malaysia ,date
FROM covid19_death$ WHERE Location = ‘Malaysia’ and total_deaths != ‘NULL’
ORDER BY date
Observations:
- From 2020-01-24 ~ 2020-03-16 the population calculation result is NULL.
- To avoid confusion during visualization, the NULL value should be filtered out.
- Malaysia Population Decrease percentage is increasing
Percent Population Vaccinated
SQL Query:
WITH tempPopulationVaccinated (continent, location, date, population, new_vaccinations_smoothed, AccumulateNewVaccination) AS
(
SELECT Death.continent, Death.location, Death.date, cast(Death.population as decimal), Vaccine.new_vaccinations_smoothed
, SUM(cast(Vaccine.new_vaccinations_smoothed as decimal)) OVER(ORDER BY Death.date) AS AccumulateNewVaccination
FROM covid19_death$ Death INNER JOIN covid19_vaccination$ Vaccine
ON Death.location = Vaccine.location
AND Death.date = Vaccine.date
WHERE Death.location = ‘Malaysia’
group by Death.location, Death.continent, Death.date, Death.population, Vaccine.new_vaccinations_smoothed
)
SELECT *, (AccumulateNewVaccination/population) * 100 AS vaccinatedPopulation FROM tempPopulationVaccinated
Observations:
- Vaccination starts from 2021-02-24
- Malaysia population vaccinated is increasing from 2021-02-24 to 2022-03-15