WITH RankedExpenditure AS (
SELECT
country,
year,
military_expenditure_of_gdp,
RANK() OVER (PARTITION BY year ORDER BY military_expenditure_of_gdp DESC) AS rank
FROM
"@kaggle.prasertk_military_expenditure_by_country_from_19702020.military_expenditure"
)
SELECT
country,
year,
military_expenditure_of_gdp
FROM
RankedExpenditure
WHERE
rank = 1
ORDER BY
year DESC;