開始使用免費開始

探索演員的國籍與性別

在資料庫的每部電影中,已經在 actors 資料表辨識並列出最重要的 3 位演員。此資料表包含演員的 nationalitygender。我們想了解演員在國籍上的多元程度,以及名單中有多少男演員與女演員。

本練習屬於課程

以資料驅動的 SQL 決策制定

檢視課程

練習說明

  • 分別計算 actors 資料表中各國家的演員人數、男性與女性演員人數,以及演員總數。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

SELECT 
	___ -- Select nationality of the actors
    ___ -- Select gender of the actors
    ___ -- Count the number of actors
FROM actors
GROUP BY GROUPING SETS ((___), (___), (___)); -- Use the correct GROUPING SETS operation
編輯並執行程式碼