開始使用免費開始

這是進階歌曲嗎?

在上一個練習中,你使用 Snowflake UI 瀏覽了之後會用到的資料庫與資料表。整門課程中,我們會在 Snowflake UI 和你現在看到的查詢編輯器之間來回切換。現在,該實作 CASE 敘述了。首先,你會使用 track 資料表來將每首歌的單價分類。開始吧!

本練習屬於課程

Snowflake 中的資料操作

檢視課程

練習說明

  • 開始撰寫一個 CASE 敘述,用來分類歌曲的價格。
  • 如果歌曲的 unit_price0.99,將其標記為 'Standard Song'
  • 如果歌曲的 unit_price1.99,將其標記為 'Premium Song'

動手互動練習

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

SELECT
	name,
    composer,
    -- Begin a CASE statement
    ___
        -- A song priced at 0.99 should be a 'Standard Song'
    	WHEN ___ = ___ THEN '___'
        -- Songs costing 1.99 should be denoted as 'Premium Song'
        ___ unit_price = 1.99 ___ '___'
    END AS song_description
FROM store.track;
編輯並執行程式碼