Score Histogram Including Empty Buckets
Hard
Survey & Ratings
For question 1, count responses in the buckets 0-3, 4-6, 7-8 and 9-10, showing buckets with zero responses. Order by bucket start.
Table schema
Buckets(label VARCHAR(10), lo INT, hi INT)
Responses(id INT PRIMARY KEY, respondent INT, question INT, score INT)Sample data
Buckets
label | lo | hi
0-3 | 0 | 3
4-6 | 4 | 6
7-8 | 7 | 8
9-10 | 9 | 10
Responses
id | respondent | question | score
1 | 1 | 1 | 9
2 | 1 | 2 | 4
3 | 2 | 1 | 7
4 | 2 | 2 | 5
5 | 3 | 1 | 10
6 | 3 | 2 | 5
7 | 4 | 1 | 3
Discussion
No discussions yet.
Shalyam Support
Hi! Ask us anything — we'll reply on WhatsApp or Telegram within 24 hours.