開始使用免費開始

爵士歌曲都很長嗎?

你的主管提出一個問題:不同曲風的曲目長度有何差異?為了回答這個問題,你需要使用子查詢把 trackgenre 資料表串接起來。加油!

本練習屬於課程

Snowflake 中的資料操作

檢視課程

練習說明

  • 從子查詢中 SELECTgenre_name,並找出各曲風的平均毫秒數。
  • 更新查詢,讓資料是 FROM 子查詢取得。
  • 為了正確計算每首歌的平均長度,請以 genre_name 分組結果。

動手互動練習

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

SELECT
	-- Find the genre name and average milliseconds
    ___,
    ___ AS average_milliseconds
-- Retrieve records from the result of the subquery
___ (
    SELECT
        genre.name AS genre_name,
        track.genre_id,
        track.milliseconds
    FROM store.track
    JOIN store.genre ON track.genre_id = genre.genre_id
)
-- Group the results by the genre name
___ ___ ___;
編輯並執行程式碼