SQL to create histograms | Dark Hacker News