DEV Community

Cover image for Exploratory Data Analysis Using SQL.
Oluwafunmilola Obisesan
Oluwafunmilola Obisesan

Posted on • Updated on

Exploratory Data Analysis Using SQL.

INTRODUCTION

Two years ago when I started learning how to write SQL code and learning how to work with SQL, it felt complex and disjointed to me. But now, working with SQL is one of my favorite thing to do and I totally enjoy analyzing datasets with SQL.

In this project, I carried out an exploratory analysis on petrol/gas prices around the world. The dataset contains records of petrol/gas prices of ALL the countries in the world, daily petrol/gas consumption of each country ,varying prices per liter and barrel as of June, 2022.

Using SQL, I was able to run some queries through the dataset and get answers to some questions and also to get insights.

DATA PREPARATION AND CLEANING.

The dataset was first loaded into Microsoft Excel in order to “clean” the dataset, rename the columns, remove outliers and to check for consistency in the dataset.
Here is a picture of the dataset in Microsoft Excel:
Image description

A database was then created in MYSQL, and the dataset was imported into the SQL workbench in order to begin analysis.
Picture of the dataset after being imported into the SQL workbench:

Image description

Image description

ANALYSIS

Analysis was done to get answers to some very important questions and to get an understanding of the dataset.

PETROL/ GAS CONSUMPTION AROUND THE WORLD.

1)To start with, I wanted to know the total sum of barrel of petrol/gas consumed by the entire world on a daily basis.

Image description

The query above shows the world consumes 96,576,722 barrels of petrol/ gas on a daily basis, as of June 2022.

2.Country with the highest petrol/gas consumption daily:

Image description

The United States of America consumes the most petrol/gas daily.
19,687,287 barrels per day.

3.Country with the least petrol/ gas consumption daily:

Image description

Niue consumes the least petrol/ gas in the world. 51 barrels per day.
Until while carrying out this analysis, I didn’t know of the country called Niue, had to google it up and realized it’s a country with an average of 1,620 people, located in the Oceania continent.

4.Top five countries with the highest daily oil consumption:

Image description

USA, China, India, Japan and Russia consumes the most petrol/gas daily .

5.Bottom five countries with the lowest oil consumption around the world:

Image description

Niue, Salt Helena, Monsterrat, Kiribati, Saint Pierre & Miquelon consumes the least petrol/ gas around the world.

PETROL/ GAS PRICE ANALYSIS AROUND THE WORLD:

1.Country with the highest price for a liter of petrol/gas.

Image description

North Korea sells a liter of petrol/gas for $14.5!
Wow!

2.Country with the least price for a liter of petrol/gas:

Image description

Venezuela sells the cheapest petrol/gas in the world, with a liter going for a paltry $0.02 dollar.

3.Country with the highest and lowest price per gallon :

Image description

Image description

Consistent with the data above, North Korea and Venezuela sells petrol/ gas for the highest and cheapest price per gallon respectively.

4.Top five countries with the most expensive price for a liter of petrol/gas:

Image description

North Korea, Tonga, Niue, Honk Kong, and Norway sells a liter of petrol/gas for the most expensive amount.

5.Bottom five countries with the cheapest price for petrol/ gas:

Image description

Venezuela, Libya, Iran, Brunei and Syria sells a liter of petrol/ gas for the cheapest prices.

        ******
Enter fullscreen mode Exit fullscreen mode

Thanks for reading!

Comments and suggestions, please do send a mail: heyfunmi@gmail.com

Top comments (2)

Collapse
 
muba_studio profile image
Muba Studio

Impressive article, Funmi. Your curation skills are outstanding. Congratulations on a job well done!

Collapse
 
heyfunmi profile image
Oluwafunmilola Obisesan

Thank you.