Dropbox's storage analytics team wants to understand the distribution of completed file uploads during January 2025. Create a frequency histogram using these file-size ranges: - `0-9 MB` - `10-49 MB` - `50-99 MB` - `100+ MB` Only completed uploads from January 2025 with a known file size should be included. A zero-megabyte file belongs in the `0-9 MB` range. Return the columns in this exact order: `size_bucket`, `upload_count`, and `percentage_of_uploads`. Calculate `percentage_of_uploads` as the number of uploads in the bucket divided by the total number of eligible uploads, rounded to four decimal places. Sort by `upload_count` descending, then `size_bucket` descending. ### Table Schema | Table | Column | Type | |---|---|---| | `file_uploads` | `file_id` | integer | | `file_uploads` | `user_id` | integer | | `file_uploads` | `team_id` | integer | | `file_uploads` | `file_name` | varchar(100) | | `file_uploads` | `size_mb` | decimal(10,2) | | `file_uploads` | `uploaded_at` | timestamp | | `file_uploads` | `upload_status` | varchar(20) | ### Example Input: `file_uploads` | file_id | user_id | team_id | file_name | size_mb | uploaded_at | upload_status | |---:|---:|---:|---|---:|---|---| | 1 | 101 | 10 | notes.txt | 2.50 | 2025-01-03 09:00:00 | completed | | 2 | 102 | 10 | design.png | 25.00 | 2025-01-05 10:00:00 | completed | | 3 | 103 | 11 | video.mp4 | 125.00 | 2025-01-06 11:00:00 | completed | | 4 | 104 | 11 | archive.zip | 180.00 | 2025-01-08 12:00:00 | completed | | 5 | 105 | 12 | failed.mov | 75.00 | 2025-01-09 13:00:00 | failed | | 6 | 106 | 12 | report.pdf | 45.00 | 2025-01-10 14:00:00 | completed | ### Example Output Explanation There are five eligible uploads because the failed upload is excluded. One file belongs to `0-9 MB`, two belong to `10-49 MB`, none belong to `50-99 MB`, and two belong to `100+ MB`. Each bucket's percentage is calculated using five as the denominator.
DROP TABLE IF EXISTS file_uploads; CREATE TABLE file_uploads ( file_id INT, user_id INT, team_id INT, file_name VARCHAR(100), size_mb DECIMAL(10,2), uploaded_at TIMESTAMP, upload_status VARCHAR(20) ); INSERT INTO file_uploads VALUES (1,101,10,'notes.txt',2.50,'2025-01-03 09:00:00','completed'), (2,102,10,'design.png',25.00,'2025-01-05 10:00:00','completed'), (3,103,11,'video.mp4',125.00,'2025-01-06 11:00:00','completed'), (4,104,11,'archive.zip',180.00,'2025-01-08 12:00:00','completed'), (5,105,12,'failed.mov',75.00,'2025-01-09 13:00:00','failed'), (6,106,12,'report.pdf',45.00,'2025-01-10 14:00:00','completed');