Loading problem...
You are given two relational tables used by a commerce analytics platform.
Table: product
Table: sales
Business rule:
Task:
Supported submission environments:
product:
| product_id | product_name | unit_price |
|------------|--------------|------------|
| 1 | Nimbus X | 1000 |
| 2 | Orion One | 1300 |
| 3 | Aero Lite | 700 |
sales:
| seller_id | product_id | buyer_id | sale_date | quantity | price |
|-----------|------------|----------|-------------|----------|-------|
| 10 | 1 | 1 | 2024-01-03 | 1 | 1000 |
| 11 | 3 | 1 | 2024-01-08 | 1 | 700 |
| 12 | 1 | 2 | 2024-01-11 | 1 | 1000 |
| 13 | 2 | 2 | 2024-01-12 | 1 | 1300 |
| 14 | 3 | 3 | 2024-01-20 | 2 | 1400 |[
{"buyer_id":1}
]Buyer 1 bought Nimbus X and never bought Orion One. Buyer 2 bought both and is excluded. Buyer 3 never bought Nimbus X.
product:
| product_id | product_name | unit_price |
|------------|--------------|------------|
| 100 | Nimbus X | 950 |
| 200 | Orion One | 1200 |
| 300 | Echo Mini | 500 |
sales:
| seller_id | product_id | buyer_id | sale_date | quantity | price |
|-----------|------------|----------|-------------|----------|-------|
| 7 | 100 | 40 | 2025-02-01 | 1 | 950 |
| 7 | 100 | 40 | 2025-02-01 | 1 | 950 |
| 9 | 300 | 41 | 2025-02-09 | 1 | 500 |
| 8 | 100 | 42 | 2025-02-10 | 1 | 950 |
| 8 | 200 | 42 | 2025-02-15 | 1 | 1200 |[
{"buyer_id":40}
]Duplicate purchases do not change eligibility. Buyer 40 still appears once.
product:
| product_id | product_name | unit_price |
|------------|--------------|------------|
| 5 | Nimbus X | 990 |
| 6 | Orion One | 1250 |
| 7 | Nova Pad | 780 |
sales:
| seller_id | product_id | buyer_id | sale_date | quantity | price |
|-----------|------------|----------|-------------|----------|-------|
| 1 | 6 | 11 | 2023-11-01 | 1 | 1250 |
| 2 | 7 | 12 | 2023-11-02 | 1 | 780 |
| 3 | 5 | 13 | 2023-11-03 | 1 | 990 |[
{"buyer_id":13}
]Only buyer 13 satisfies target purchase without forbidden purchase.
Constraints