Analyze International Debt Statistics : Datacamp

오유찬·2025년 12월 22일

SQL

목록 보기
25/71

-- num_distinct_countries
SELECT	COUNT(DISTINCT country_code) as total_distinct_countries
FROM	international_debt


-- highest_debt_country
SELECT	country_name, total_debt
FROM	(SELECT	country_name, SUM(debt) as total_debt
		FROM	international_debt
		GROUP BY country_name
		ORDER BY SUM(debt) DESC) as hightest_debt
LIMIT 	1


-- lowest_principal_repayment 
SELECT	country_name, indicator_name, 
		SUM(debt) as lowest_repayment
FROM	international_debt
WHERE	indicator_code = 'DT.AMT.DLXF.CD'
GROUP BY country_name, indicator_name
ORDER BY lowest_repayment ASC
LIMIT 	1
profile
열심히 하면 재밌다

0개의 댓글