• Ramsay Lewis

SQL Project: Exploring World COVID-19 Data

Updated: Oct 21



This is Part 1 of a data science project exploring Covid Data. Find Part 2 here.


This project explores COVID-19 vaccination and death rates around the world. It’s simply meant to satisfy some of my curiosities about the differences in vaccination rates and death rates among various countries.


It’s also an excuse to build my SQL skills. So I’ll explain how I built the database I’m using and I’ll include my SQL queries as well. You can see the full project code on GitHub. I also built a quick dashboard on Tableau.


Methods and Tools

Data source: I used the Our World in Data website as the source for this data. I downloaded the full dataset on Jul 13, 2022, as a CSV file.

SQL tools: For this project, I used PostgreSQL, which you can download from here. I also used pgAdmin, which is a web-based graphical user interface that makes it easier to work with SQL databases in PostgreSQL. You can download that from here.


Importing the data: To learn how to import the data into an SQL database, check out this video.


Analyses and Results

First, I looked at the number of cases, the number of deaths, and the percentage of people that contracted Covid that died from it. I looked at these numbers in three countries: Brazil, Canada, and the United States.


Global case count

As of July 2022, there were 556 million cases, with over 6 million deaths. About 1.13% of people that contracted Covid-19 ultimately died from it.




Which countries had the most cases?

The United States had the highest number of cases of any country in the world with almost 89 million. Brazil is third with just over 33 million. Canada is 32nd in the world with just under 4 million.


Of course, we need to consider that these countries had different populations to begin with—the United States and Brazil both have significantly higher populations than Canada. So it’s more interesting to look at the proportion of the population that became infected, rather than the overall case count.


Canada still fared better: it had a lower percentage of the population become infected than either Brazil or the US.

  • In the US, Covid cases equaled 26.4% of the population

  • In Brazil, Covid cases equaled 15.4% of the population

  • In Canada, Covid cases equaled 10.5% of the population

In other words, of the three countries, the US had the highest share of cases with respect to the size of its population. Canada had the lowest.




Which countries had the most deaths?

The pattern is similar with respect to Covid deaths. Globally, there have been 6.3 million deaths from Covid. The United States alone had 1,021,838 while Brazil also had a staggering number of deaths at 674,102. Canada has just 42,219.


Again, though, it’s critical to look at those numbers in comparison to the country’s overall population.

  • In the US, by July, 0.30% of the entire population had died from Covid.

  • In Brazil, 0.31% of the entire population had died from Covid.

  • In Canada, just 0.11% of the population had died from Covid.


In other words, Brazil and the US are about the same in terms of the share of their population that had died from Covid. Canada seems to have fared significantly better.


In which country was Covid the most lethal?

The above section was about overall deaths from Covid. Here, I’m interested in looking at the total number of deaths compared to the total number of cases. In other words, of the people that contracted Covid, how many died?

  • In the US, by July, 1.15% of the people that got Covid died from it

  • In Brazil, 2.04% of the people that got Covid died from it

  • In Canada, just 1.06% of the people that got Covid died from it

In other words, Canada did the best job at minimizing deaths for those that got Covid. People that got Covid were more likely to die if they lived in Brazil.


What about vaccines?

Vaccines have been very effective at bringing down the death rate. According to a review on the effectiveness of Covid vaccines (from data collected from Israel, Sweden the United States of America, and the United Kingdom), the Pfizer/BioNTech, Moderna, and Oxford/AstraZeneca vaccines have reduced people's chances of infection and hospitalization by more than 80%.


One study estimates that Covid 19 vaccines have saved 20 million lives as of June 2022.


So how many people in each country were vaccinated by July 2022?


  • In the US, by July, just over 260 million people were vaccinated (77% of the population)

  • In Brazil, just under 185 million people were vaccinated (86% of the population)

  • In Canada, just over 32.8 million people were vaccinated (86% of the population)


The US lagged behind both Canada and Brazil in terms of vaccinations by July 2022.


Discussion and Conclusions

I conducted this project mainly just to practice using SQL, but it was interesting to explore some of the Covid death and vaccination data and compare Brazil, Canada, and the US.


Canada seemed to fare the best of the three countries, at least up until July 2022 when this data was current. It had the lowest percentage of the population contracting Covid, the lowest percentage of people dying from Covid, and the lowest percentage of people who contracted Covid die from it.


Brazil and the US fared better on different metrics. Brazil had a lower percentage of people who contracted Covid compared to the US. But of those that did contract Covid, fewer people died of it in the US.


Both Canada and Brazil had similar high vaccination rates, while the US lags behind considerably.


11 views0 comments