Country-level subtotals
You want to look at three Scandinavian countries' earned gold medals per country and gender in the year 2004. You're also interested in Country-level subtotals to get the total medals earned for each country, but Gender-level subtotals don't make much sense in this case, so disregard them.
Questo esercizio fa parte del corso
PostgreSQL Summary Stats and Window Functions
Istruzioni dell'esercizio
- Count the gold medals awarded per country and gender.
- Generate
Country-level gold award counts.
Esercizio pratico interattivo
Prova a risolvere questo esercizio completando il codice di esempio.
-- Count the gold medals per country and gender
SELECT
___,
___,
COUNT(*) AS Gold_Awards
FROM Summer_Medals
WHERE
Year = 2004
AND Medal = 'Gold'
AND Country IN ('DEN', 'NOR', 'SWE')
-- Generate Country-level subtotals
GROUP BY ___, ___
ORDER BY Country ASC, Gender ASC;