101
0/304
Loading content...
Your analytics team maintains two relational tables:
Task: Generate a sales report that includes, for each sale row, the product name together with the recorded year and unit price.
Output schema (exact column order):
Notes:
Supported submission environments:
sales:
| sale_id | product_id | year | quantity | price |
|---------|------------|------|----------|-------|
| 1 | 100 | 2008 | 10 | 5000 |
| 2 | 100 | 2009 | 12 | 5000 |
| 7 | 200 | 2011 | 15 | 9000 |
product:
| product_id | product_name |
|------------|--------------|
| 100 | Nokia |
| 200 | Apple |
| 300 | Samsung |[
{"product_name":"Apple","year":2011,"price":9000},
{"product_name":"Nokia","year":2008,"price":5000},
{"product_name":"Nokia","year":2009,"price":5000}
]Each sale is enriched with its matching product_name by product_id. Unsold products in product are irrelevant to the result.
sales:
| sale_id | product_id | year | quantity | price |
|---------|------------|------|----------|-------|
| 11 | 10 | 2020 | 2 | 300 |
| 12 | 20 | 2021 | 1 | 700 |
| 13 | 10 | 2021 | 5 | 350 |
product:
| product_id | product_name |
|------------|--------------|
| 10 | Router |
| 20 | Switch |
| 30 | Rack |[
{"product_name":"Router","year":2020,"price":300},
{"product_name":"Router","year":2021,"price":350},
{"product_name":"Switch","year":2021,"price":700}
]Multiple sales can map to the same product_id across years. Each matching sale row must appear once.
sales:
| sale_id | product_id | year | quantity | price |
|---------|------------|------|----------|-------|
| 21 | 501 | 2019 | 10 | 1200 |
| 22 | 502 | 2019 | 8 | 1300 |
product:
| product_id | product_name |
|------------|--------------|
| 501 | Bundle |
| 502 | Bundle |[
{"product_name":"Bundle","year":2019,"price":1200},
{"product_name":"Bundle","year":2019,"price":1300}
]Join keys are product IDs, not product names. Different IDs can legitimately share the same product_name.
Constraints