開始使用免費開始

建立零售資料表

業務開發團隊認為,在每間健身房新增零售據點,有機會提高營收。在這間館內小店裡,他們會販售毛巾、球鞋和飲料等商品。為了追蹤銷售的商品,他們需要在 CORE_GYM 結構定義中新增一個資料表。要建立這個資料表,他們找上你。展現一下你的身手吧!

本練習屬於課程

Snowflake 的資料型別與函式

檢視課程

練習說明

  • 建立一個 transaction_id 數值欄位,precision 為 16、scale 為 0。
  • pre_tax_amount 定義為 NUMBER,小數點右側可有 2 位,總位數為 6。
  • 加入一個 tax_rate 欄位,可以儲存例如 28.625 的數值;總位數為 5,其中小數點右側為 3 位。

動手互動練習

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

CREATE OR REPLACE TABLE retail (
  	-- transaction_id stores 16 total digits with 0 right of the decimal point
    ___ NUMBER(16, 0),
  	-- pre_tax_amount stores up to 6 digits with 2 right of the decimal point
    ___,
  	-- tax_rate stores up to 5 digits with 3 right of the decimal point
    ___,
    transaction_total NUMBER(6, 2)
);
編輯並執行程式碼