101
0/304
Loading content...
A subscription analytics team stores customer-level annual revenue snapshots and needs a clean list of accounts that ended 2021 above break-even.
Table: customers
Data guarantees:
Task: Return all customer_id values that satisfy both conditions:
Output requirements:
Supported submission environments:
customers:
| customer_id | year | revenue |
|-------------|------|---------|
| 1 | 2018 | 50 |
| 1 | 2021 | 30 |
| 1 | 2020 | 70 |
| 2 | 2021 | -50 |
| 3 | 2018 | 10 |
| 3 | 2016 | 50 |
| 4 | 2021 | 20 |[
{"customer_id":1},
{"customer_id":4}
]Customers 1 and 4 have strictly positive revenue in 2021. Customer 2 is negative in 2021, and customer 3 has no 2021 row.
customers:
| customer_id | year | revenue |
|-------------|------|---------|
| 11 | 2019 | 8 |
| 12 | 2022 | 90 |
| 13 | 2020 | -2 |[]No row meets year=2021 and revenue>0 simultaneously.
customers:
| customer_id | year | revenue |
|-------------|------|---------|
| 40 | 2021 | 0 |
| 41 | 2021 | 300 |
| 42 | 2021 | -1 |
| 43 | 2017 | 1000 |[
{"customer_id":41}
]Revenue must be strictly greater than zero in 2021. Zero and negative values are excluded, and positive values in other years do not qualify.
Constraints