You're working as a data analyst for a growing e-commerce company that needs to identify their most valuable customers for the year 2021. The finance team has provided you with a database table containing customer revenue data across multiple years.
Given a Customers table with the following structure:
| Column Name | Type |
|---|---|
| customer_id | int |
| year | int |
| revenue | int |
Where (customer_id, year) forms the primary key, your task is to find all customers who generated positive revenue in 2021. Note that revenue can be negative (perhaps due to returns or refunds exceeding purchases).
Goal: Write a SQL query to return the customer_id of all customers with positive revenue in 2021. The result can be returned in any order.
This problem tests your ability to filter data based on multiple conditions and work with business logic in SQL queries.
Input & Output
Constraints
- 1 โค customer_id โค 105
- 2019 โค year โค 2023
- -1000 โค revenue โค 10000
- Each (customer_id, year) combination is unique
- Focus on year 2021 only