Equal-width Binning
Learn how to use equal-width binning using SQL.
Overview
Equal-width binning divides values into ranges of equal width. Unlike equal-height binning, where all buckets have roughly the same frequency, in equal-width binning, each bucket can have a different frequency.
Equal-width binning is often used to produce histograms—a bar chart that shows the frequency of each bucket. A histogram makes it easier to get a sense of how the data is distributed and what are the most and least frequent values.
Equal-width binning using arithmetic
Given a table of student grades, we want to visualize the distribution of grades. We can divide the range of possible scores 1–100 into 10 equal-width buckets. To assign each value to a bucket, we divide it by the desired width of the bucket, 10
:
Get hands-on with 1400+ tech skills courses.