I have some code borrowed from a previous stackoverflow post which makes it easy to create histogram data out of a large table. I repeat it below:
SELECT ROUND(numeric_value, -2) AS bucket,
COUNT(*) AS COUNT,
FROM my_table
GROUP BY bucket;
[I removed references to the BAR column as I don't need it.] The problem is it is only possible to vary the bucket size by one order of magnitude (by changing the ROUND attribute), how would I change the code to enable me to change the bucket size with more flexibility? For example, if I wanted to state the numerical size of each bucket?
Thanks!