支援 SBA 行銷活動
SBA 近期發現其貸款申請數量下滑。你受雇建立一個資料庫,以支援行銷活動並提升 SBA 貸款申請量。在此練習中,你將定義一個 campaign 資料表,用來追蹤活動特性與成效。此資料表的欄位說明如下:
id欄位:為每個活動指派唯一識別碼。name欄位:長度限制為 50 個字元。budget欄位:金額需小於 $100,000。num_days欄位:表示活動天數(通常為 180 天以內)。goal_amount欄位:用來追蹤目標申請件數。num_applications欄位:用來追蹤實際收到的申請件數。
本練習屬於課程
建立 PostgreSQL 資料庫
練習說明
- 定義
campaign資料表,包含必要欄位(id、name、budget、num_days、goal_amount、num_applications),並為每個欄位指定「最」合適的資料型別。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
-- Create the campaign table
___ ___ ___ (
-- Unique identifier column
___ ___ PRIMARY KEY,
-- Campaign name column
___ ___(50),
-- The campaign's budget
___ NUMERIC(___, ___),
-- The duration of campaign in days
___ ___ DEFAULT 30,
-- The number of new applications desired
___ ___ DEFAULT 100,
-- The number of received applications
___ ___ DEFAULT 0
);