Skip to content
Project: Analyze International Debt Statistics
It's not that we humans only take debts to manage our necessities. A country may also take debt to manage its economy. For example, infrastructure spending is one costly ingredient required for a country's citizens to lead comfortable lives. The World Bank is the organization that provides debt to countries.
In this notebook, we are going to analyze international debt data collected by The World Bank. The dataset contains information about the amount of debt (in USD) owed by developing countries across several categories. We are going to find the answers to questions like:
- What is the total amount of debt that is owed by the countries listed in the dataset?
- Which country owes the maximum amount of debt and what does that amount look like?
- What is the average amount of debt owed by countries across different debt indicators?
Below is a basic schema of the database you will be working with:
debt_indicators
table
debt_indicators
tableColumn | Definition | Data Type |
---|---|---|
country_name | Name of the country | varchar |
country_code | Code representing the country | varchar |
indicator_name | Description of the debt indicator | varchar |
indicator_code | Code representing the debt indicator | varchar |
debt | Value of the debt indicator for the given country (in current US dollars) | float |
You will execute SQL queries to answer six questions, as listed in the instructions.
DataFrameavailable as
num_distinct_countries
variable
--num_distinct_countries
SELECT
COUNT(DISTINCT country_name) AS total_distinct_countries
FROM international_debt
DataFrameavailable as
distinct_debt_indicators
variable
--distinct_debt_indicators
SELECT
COUNT(DISTINCT indicator_code) AS distinct_debt_indicators
FROM international_debt
GROUP BY indicator_code
ORDER BY distinct_debt_indicators
DataFrameavailable as
total_debt
variable
--total_debt
SELECT
ROUND(SUM(debt/1000000), 2) AS total_debt
FROM international_debt
--GROUP BY country_name
--ORDER BY total_debt DESC
DataFrameavailable as
highest_debt_country
variable
--highest_debt_country
SELECT country_name, SUM(debt) AS total_debt
FROM international_debt
GROUP BY country_name
ORDER BY total_debt DESC
LIMIT 1
DataFrameavailable as
avg_debt_per_indicator
variable
--avg_debt_per_indicator
SELECT
COUNT(debt) AS debt_indicator,
indicator_name,
AVG(debt) AS average_debt
FROM international_debt
GROUP BY indicator_name
ORDER BY average_debt DESC