I studied the ranking system, sorting on some sites: Reddit, Hacker News, Lobster and came across an article for 2011-08-16. I found her interesting.
This is a post about a super quick-and-dirty way to create a histogram in MySQL for numeric values.
There are multiple other ways to create histograms that are better and more flexible, using CASE statements and other types of complex logic. This method wins me over time and time again since it's just so easy to modify for each use case, and so short and concise.
This is how you do it:
SELECT ROUND(numeric_value, -2) AS bucket,
COUNT(*) AS COUNT,
RPAD('', LN(COUNT(*)), '*') AS bar
FROM my_table
GROUP BY bucket;
http://blog.shlomoid.com/2011/08/how-to-quickly-create-histogram-in.htmlI don't know if this is the right place to post it here. And I apologize for my English.
P.S. Your site, forum, articles are interesting, I read, I look. Thank you.