

 Amazon Redshift 將不再支援從修補程式 198 開始建立新的 Python UDFs。現有 Python UDF 將繼續正常運作至 2026 年 6 月 30 日。如需詳細資訊，請參閱[部落格文章](https://aws.amazon.com/blogs/big-data/amazon-redshift-python-user-defined-functions-will-reach-end-of-support-after-june-30-2026/)。

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 範本資料庫
<a name="c_sampledb"></a>

本節說明 TICKIT，這是 Amazon Redshift 文件範例所使用的範例資料庫。

此小型資料庫包含七個資料表：兩個事實資料表和五個維度。您可以依照《Amazon Redshift 入門指南》中[步驟 4：從 Amazon S3 將資料載入 Amazon Redshift](https://docs.aws.amazon.com/redshift/latest/gsg/rs-gsg-create-sample-db.html) 的步驟載入 TICKIT 資料集。

![\[TICKIT 範例資料庫中的七個資料表及其彼此的關係。\]](http://docs.aws.amazon.com/zh_tw/redshift/latest/dg/images/tickitdb.png)


此範例資料庫應用程式可協助對虛擬 TICKIT 網站的追蹤銷售活動之分析，使用者會在該網站中線上購買和銷售運動活動、表演和演唱會的門票。分析可特別辨識門票隨著時間的動向、賣方的成功比率以及熱賣活動、會場和季節。分析可使用此資訊來為經常造訪網站的買方和賣方提供誘因，以吸引新使用者和促使廣告和促銷。

例如，下列查詢會根據在 2008 所售的門票數，找到在聖地牙哥中前五大賣方：

```
select sellerid, username, (firstname ||' '|| lastname) as name,
city, sum(qtysold)
from sales, date, users
where sales.sellerid = users.userid
and sales.dateid = date.dateid
and year = 2008
and city = 'San Diego'
group by sellerid, username, name, city
order by 5 desc
limit 5;

sellerid | username |       name        |   city    | sum
----------+----------+-------------------+-----------+-----
49977 | JJK84WTE | Julie Hanson      | San Diego |  22
19750 | AAS23BDR | Charity Zimmerman | San Diego |  21
29069 | SVL81MEQ | Axel Grant        | San Diego |  17
43632 | VAG08HKW | Griffin Dodson    | San Diego |  16
36712 | RXT40MKU | Hiram Turner      | San Diego |  14
(5 rows)
```

在指南中用於此範例的資料庫包含小型資料集，兩個事實資料表各包含少於 200,000 個的列，在 CATEGORY 資料表中來自 11 個列的維度範圍高達約 50,000 列 (在 USERS 資料表)。

此指南中的資料庫範例特別示範 Amazon Redshift 資料表設計的主要功能：
+ 資料分佈
+ 資料排序
+ 直欄式壓縮

如需 TICKIT 資料庫中資料表結構描述的相關資訊，請選擇下列索引標籤：

------
#### [ CATEGORY table ]

[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/redshift/latest/dg/c_sampledb.html)

------
#### [ DATE table ]

[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/redshift/latest/dg/c_sampledb.html)

------
#### [ EVENT table ]

[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/redshift/latest/dg/c_sampledb.html)

------
#### [ VENUE table ]

[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/redshift/latest/dg/c_sampledb.html)

------
#### [ USERS table ]

[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/redshift/latest/dg/c_sampledb.html)

------
#### [ LISTING table ]

[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/redshift/latest/dg/c_sampledb.html)

------
#### [ SALES table ]

[\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/redshift/latest/dg/c_sampledb.html)

------