The monthly trading report wants one row per month and one column per product category, whether or not that category sold anything.
One row per month that has at least one sale, with the columns:
month — 'YYYY-MM'BOOKS, GAMES, TOYS — that month's revenue in each, rounded to 2 decimal places, and 0.0 where there was noneCategories outside those three are not reported. A month that contains only such sales still gets a row, with three zeros.
| month | BOOKS | GAMES | TOYS |
|---|---|---|---|
| 2024-01 | 100.0 | 20.0 | 50.5 |
| 2024-02 | 15.25 | 0.0 | 0.0 |
amount contributes nothing. It does not make the month null.sales| amount | sale_id | sold_at | category |
|---|---|---|---|
| 100 | 1 | 2024-01-05T00:00:00Z | BOOKS |
| 50.5 | 2 | 2024-01-09T00:00:00Z | TOYS |
| 20 | 3 | 2024-01-20T00:00:00Z | GAMES |
| 10 | 4 | 2024-02-02T00:00:00Z | BOOKS |
| 5.25 | 5 | 2024-02-11T00:00:00Z | BOOKS |
| month | BOOKS | GAMES | TOYS |
|---|---|---|---|
| 2024-01 | 100 | 20 | 50.5 |
| 2024-02 | 15.25 | 0 | 0 |
sales| amount | sale_id | sold_at | category |
|---|---|---|---|
| 7 | 1 | 2024-03-01T00:00:00Z | TOYS |
| 3 | 2 | 2024-03-15T00:00:00Z | TOYS |
| month | BOOKS | GAMES | TOYS |
|---|---|---|---|
| 2024-03 | 0 | 0 | 10 |
Community-reported interview topic. Not an official company question and no affiliation is implied.
Run against the public tests, or submit to score against all of them.