创建一个"other"类别
如果我们想按邮政编码汇总 Evanston 的 311 请求,把所有低频的邮编合并到一个"other"类别会很有用。
下列哪个数值替换查询中的 ???,会得到如下结果?
查询:
SELECT CASE WHEN zipcount < ??? THEN 'other'
ELSE zip
END AS zip_recoded,
sum(zipcount) AS zipsum
FROM (SELECT zip, count(*) AS zipcount
FROM evanston311
GROUP BY zip) AS fullcounts
GROUP BY zip_recoded
ORDER BY zipsum DESC;
结果:
zip_recoded zipsum
60201 19054
60202 11165
null 5528
other 429
60208 255
本练习是课程的一部分
