<aside> 📌 As one of the most important concepts in finance, debt is not only important to each individual but also to various countries across the globe as they often use debts to manage their spending and economic status.
</aside>
<aside> 📌 In this project, I will be trying to derive some insights from the publicly available international debt stats from the World Bank(1950-2015) which focuses on the debt situation in developing counties globally.
</aside>
%%sql
postgresql:///international_debt
select * from international_debt
// extract the number of unique countries present in the table
%%sql
SELECT count(distinct country_code) AS total_distinct_countries
FROM international_debt;
// global debt level
%%sql
SELECT round( SUM(debt) /1000000 ,2) as total_debt
FROM international_debt;
// sorting total amount of debts by countries
%%sql
select
country_name,
max(debt) as maximum_debt
from international_debt
group by country_name
order by maximum_debt desc
limit 10;
// extract the types of distinct_debt_indicators
%%sql
select distinct indicator_code as distinct_debt_indicators
from international_debt
order by distinct_debt_indicators;
//which indicator is the most common/imporant one
%%sql
select
indicator_code,
count(indicator_code) as indicator_count
from international_debt
group by indicator_code
order by indicator_count desc,indicator_code desc
limit 20;
// calculate the average amount of debts for all coutries across indicators
%%sql
SELECT
indicator_code AS debt_indicator,
indicator_name ,
avg(debt) as average_debt
FROM international_debt
GROUP BY debt_indicator,indicator_name
ORDER BY average_debt desc
limit 10;
// which country owes the most amount of debts
%%sql
SELECT
country_name,
sum(debt) as total_debt
FROM international_debt
GROUP BY country_name
ORDER BY total_debt desc
limit 1;
// which country owes the highest amount of debt in the category of long term debts
%%sql
SELECT
country_name ,
indicator_name
FROM international_debt
WHERE debt = (SELECT
max(debt)
FROM international_debt
where indicator_code='DT.AMT.DLXF.CD');
List of distinct debt indicators:
The most common debt indicator:
The country with the highest debt: