1WITH RankedExpenditure AS (
2 SELECT
3 country,
4 year,
5 military_expenditure_current_usd,
6 RANK() OVER (PARTITION BY year ORDER BY military_expenditure_current_usd DESC) AS rank
7 FROM
8 "@kaggle.prasertk_military_expenditure_by_country_from_19702020.military_expenditure"
9 WHERE
10 country NOT IN ('High Income','High income', 'Post-demographic dividend', 'OECD members', 'World', 'Europe & Central Asia')
11)
12SELECT
13 country,
14 year,
15 military_expenditure_current_usd
16FROM
17 RankedExpenditure
18WHERE
19 rank = 3
20ORDER BY
21 year DESC;