糟了,是老鼠!
「Rodents- Rats」這個類別的案件,平均要超過 64 天才結案。為什麼?
用 4 個步驟來調查:
為什麼平均值這麼高?先檢查結案時間的分佈。提示:
date_trunc()也能用在 interval。看看排除離群值之後,平均結案時間會如何改變。
忙碌月份送出的案件會不會比較久才完成?檢查每月平均結案時間與每月案件數之間的相關性。
比較每月「建立」的案件數與「完成」的案件數。
請記住:結案時間(或完成時間)是 date_completed - date_created。
本練習屬於課程
SQL 中的探索式資料分析
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
-- Truncate the time to complete requests to the day
SELECT ___ AS completion_time,
-- Count requests with each truncated time
___
FROM evanston311
-- Where category is rats
WHERE category = 'Rodents- Rats'
-- Group and order by the variable of interest
GROUP BY ___
ORDER BY ___;