報表 1:夏季奧運獎牌數最多的選手
既然你已經對資料有相當掌握,讓我們回到個案研究,建立儀表板的第一個元素「Most Decorated Summer Athletes」:

你的任務是為這個元素建立基礎報表。基礎報表需求:
- 第 1 欄為
athlete_name。 - 第 2 欄為
gold_medals。 - 只包含至少拿到 3 面獎牌的選手。
- 依獲得金牌數排序,獎牌最多者在最上方。
本練習屬於課程
SQL 報表製作
練習說明
- 透過連接
summer_games與athletes,選出athlete_name與gold_medals。 - 只包含至少 3 面金牌的
athlete_name。 - 將資料表排序,使
gold_medals最多的排在最上方。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
-- Pull athlete_name and gold_medals for summer games
SELECT
____ AS athlete_name,
____ AS gold_medals
FROM ____ AS s
JOIN ____ AS a
ON ____
GROUP BY ____
-- Filter for only athletes with 3 gold medals or more
____
-- Sort to show the most gold medals at the top
ORDER BY ____;