找出訂單總額
BigQuery 常見的用途之一是建立分析報表,例如從查詢中找出前 10 名的結果,或是在特定時間範圍內的結果。
在這個查詢中,你要使用 ecommerce.ecomm_payments,找出總成本最小的 10 筆訂單。
本練習屬於課程
BigQuery 入門
練習說明
- 從
ecommerce.ecomm_payments中選出最小的 10 筆訂單,對payment_value欄位使用SUM,並取前 10 筆資料。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
-- Add the correct column and limit values
SELECT
-- Add the column to calculate the SUM
order_id, SUM(___)
FROM
ecommerce.ecomm_payments
GROUP BY order_id
-- Add the correct column to order
ORDER BY ___
-- Add the correct number of rows to limit
LIMIT ___;