101
0/304
Loading content...
An analytics team at an online marketplace wants to detect orders with unusually concentrated demand in a single line item.
Table: orders_details
Data guarantee:
Definitions:
Task: Return each order_id whose order peak quantity is strictly greater than the global average benchmark.
Output requirements:
Supported submission environments:
orders_details:
| order_id | product_id | quantity |
|----------|------------|----------|
| 1 | 101 | 12 |
| 1 | 102 | 10 |
| 1 | 103 | 15 |
| 2 | 201 | 8 |
| 2 | 202 | 4 |
| 2 | 203 | 6 |
| 2 | 204 | 4 |
| 3 | 301 | 5 |
| 3 | 302 | 18 |
| 3 | 303 | 20 |
| 4 | 401 | 2 |
| 4 | 402 | 8 |
| 5 | 501 | 9 |
| 5 | 502 | 9 |[
{"order_id":1},
{"order_id":3}
]The highest order-level average is from order 3: (5 + 18 + 20) / 3 = 14.333.... Orders 1 and 3 have peaks 15 and 20, both strictly above 14.333....
orders_details:
| order_id | product_id | quantity |
|----------|------------|----------|
| 10 | 1 | 7 |
| 10 | 2 | 7 |
| 11 | 1 | 5 |
| 11 | 2 | 5 |
| 12 | 8 | 9 |[]Order averages are {7, 5, 9}; the global benchmark is 9. Peaks are {7, 5, 9}, so none is strictly greater than 9.
orders_details:
| order_id | product_id | quantity |
|----------|------------|----------|
| 42 | 10 | 2 |
| 42 | 11 | 100 |
| 42 | 12 | 3 |[
{"order_id":42}
]With one order, the benchmark equals that order's own average: (2 + 100 + 3) / 3 = 35. The peak 100 is strictly greater than 35.
Constraints