每日交易筆數
現在輪到你在 BikeShare 資料集上做時間型 EDA。撰寫一段查詢,找出每天共有多少交易。
有時資料集來自多個來源,這個查詢能幫助你判斷是否有遺漏資料。
本練習屬於課程
在 SQL Server 中撰寫函式與預存程序
練習說明
- 使用
CONVERT()在SELECT與GROUP BY中擷取StartDate的日期部分。 - 使用
COUNT()計算每個StartDate對應的筆數。 - 依照
StartDate的日期部分排序結果。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
SELECT
-- Select the date portion of StartDate
___(___, StartDate) as StartDate,
-- Measure how many records exist for each StartDate
___(___) as CountOfRows
FROM CapitalBikeShare
-- Group by the date portion of StartDate
___ BY ___(___, StartDate)
-- Sort the results by the date portion of StartDate
___ BY ___(___, StartDate);