เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

Are jazz songs long?

Your manager came to you with a question; how does track length differ by genre? To answer this question, you'll want to use a subquery to join the track and genre tables. Good luck!

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

Data Manipulation in Snowflake

ดูคอร์ส

คำแนะนำการฝึกหัด

  • SELECT the genre_name from the subquery and find the average milliseconds for each genre.
  • Update the query so that records are retrieved FROM the subquery.
  • To successfully find the average length of each song, group the results by 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
___ ___ ___;
แก้ไขและรันโค้ด