Skip to content

Humans not only take debts to manage 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 project, you 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. You are going to find the answers to the following questions:

  • What is the number of distinct countries present in the database?
  • What country has the highest amount of debt?
  • What country has the lowest amount of repayments?

Below is a description of the table you will be working with:

international_debt table

ColumnDefinitionData Type
country_nameName of the countryvarchar
country_codeCode representing the countryvarchar
indicator_nameDescription of the debt indicatorvarchar
indicator_codeCode representing the debt indicatorvarchar
debtValue of the debt indicator for the given country (in current US dollars)float

You will execute SQL queries to answer three questions, as listed in the instructions.

Spinner
DataFrameas
num_distinct_countries
variable
Select
	count(distinct country_name) as total_distinct_countries
From
	international_debt
Spinner
DataFrameas
highest_debt_country
variable
Select 
	country_name,
	sum(debt) as total_debt
from
	international_debt
Group by
	country_name
order by
	total_debt desc
Limit 1;
Spinner
DataFrameas
lowest_principal_repayment
variable
Select
	country_name,
	indicator_name,
	min(debt) as lowest_repayment
From
	international_debt
Where
	indicator_code = 'DT.AMT.DLXF.CD'
Group by
	1,2
Order by
	lowest_repayment 
Limit 1