Skip to content
Project: Analyze International Debt Statistics
Very basic SQL excercises working on a database with one table only. This table features countries with their international debts and repayments.
Hidden no-code
Hidden output
How many countries are in the dect statistics?
DataFrameas
num_distinct_countries
variable
-- num_distinct_countries
-- Write your query here...
SELECT
COUNT ( DISTINCT country_name ) AS total_distinct_countries
FROM public.international_debtShow top 10 countries with highest total debt!
DataFrameas
highest_debt_country
variable
-- highest_debt_country
-- Write your query here...
SELECT
country_name,
SUM(debt) as total_debt
FROM public.international_debt
GROUP BY country_name
ORDER BY total_debt DESC
LIMIT 1;Show bottom 10 countries having the lowest total debt.
DataFrameas
lowest_principal_repayment
variable
-- lowest_principal_repayment
-- Write your query here...
SELECT
country_name,
indicator_name,
MIN(debt) AS lowest_repayment
FROM public.international_debt
WHERE indicator_code = 'DT.AMT.DLXF.CD'
GROUP BY country_name, indicator_name
ORDER BY lowest_repayment ASC
LIMIT 1
;