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.
Bu egzersiz
PostgreSQL Summary Stats and Window Functions
kursunun bir parçasıdırEgzersiz talimatları
- Count the gold medals awarded per country and gender.
- Generate
Country-level gold award counts.
Uygulamalı interaktif egzersiz
Bu örnek kodu tamamlayarak bu egzersizi bitirin.
-- 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;