開始使用免費開始

在 Table Storage 中插入並查詢資料

Cipher Coffee 想為其忠誠度計畫儲存簡單、結構化的資料,而不想承擔完整資料庫的負擔。你的任務是使用 Azure Table Storage 建立一個資料表、插入忠誠度實體範例,並執行查詢以有效擷取客戶紀錄。 你會使用不同的 PartitionKey 與 RowKey 來插入實體,接著以 PartitionKey 查詢,以驗證快速查找。

本練習屬於課程

開發 Azure Storage

檢視課程

練習說明

在你的「Storage account」中,開啟「Data storage」▸「Tables」,並建立一個名為「LoyaltyProfiles」的資料表。,插入兩個實體,使用相同的「PartitionKey」為「CustomerA」,並使用不同的「RowKey」數值「1001」與「1002」。,再插入第三個實體,使用「PartitionKey」為「VIP」與「RowKey」為「2001」。,使用篩選條件 PartitionKey eq 'CustomerA' 查詢資料表,只回傳兩筆「CustomerA」實體。 Screenshot showing the Azure Portal *Tables* view with a table named LoyaltyProfiles, the Add entity panel, and a query input filtering by PartitionKey.

動手互動練習

將理論付諸實踐,立即體驗我們的互動練習

開始練習