Loading problem...
An e-commerce analytics platform tracks catalog metadata in Product and transactional records in Sales.
Product columns:
Sales columns:
Task:
Output requirements:
Supported submission environments:
Product:
| product_id | product_name | unit_price |
|------------|--------------|------------|
| 1 | S8 | 1000 |
| 2 | G4 | 800 |
| 3 | iPhone | 1400 |
Sales:
| seller_id | product_id | buyer_id | sale_date | quantity | price |
|-----------|------------|----------|------------|----------|-------|
| 1 | 1 | 1 | 2019-01-21 | 2 | 2000 |
| 1 | 2 | 2 | 2019-02-17 | 1 | 800 |
| 2 | 2 | 3 | 2019-06-02 | 1 | 800 |
| 3 | 3 | 4 | 2019-05-13 | 2 | 2800 |[
{"seller_id":1},
{"seller_id":3}
]Seller 1 and seller 3 each have total revenue 2800, which is the maximum.
Product:
| product_id | product_name | unit_price |
|------------|--------------|------------|
| 10 | Cable | 25 |
| 11 | Hub | 65 |
Sales:
| seller_id | product_id | buyer_id | sale_date | quantity | price |
|-----------|------------|----------|------------|----------|-------|
| 8 | 10 | 100 | 2021-03-01 | 4 | 100 |
| 9 | 11 | 101 | 2021-03-02 | 1 | 65 |
| 8 | 11 | 102 | 2021-03-04 | 2 | 130 |[
{"seller_id":8}
]Seller 8 accumulates 230 revenue and is the sole top seller.
Product:
| product_id | product_name | unit_price |
|------------|--------------|------------|
| 3 | Sensor | 50 |
| 4 | Mount | 20 |
Sales:
| seller_id | product_id | buyer_id | sale_date | quantity | price |
|-----------|------------|----------|-----------|----------|-------|
| (no rows) | | | | | |[]With no sales rows, there is no top seller and the result is empty.
Constraints