How can SQL be used to create histograms or perform bucketing for analytical purposes?
Role: Data Scientist
Category: Data Manipulation (SQL/Python)
Difficulty: medium
Interview Round: Other
Overview: Explain how to build histograms and bucket continuous values in SQL, from fixed-width and quantile buckets to custom ranges. Tests knowledge of grouping on a computed key, NTILE, width_bucket, CASE expressions, NULL handling and how to show buckets that contain no rows.