
Unfinished orders over 50
easyUnfinished orders over 50
Target SQL Interview Question
Target's customer service team follows up on online orders that did not go through, but only when the order was worth more than 50.
List the order_id, status and amount of every order that did not complete and was worth more than 50.
Asked of
- Data Analyst
- Business Analyst
- BI Analyst
- Product Analyst
- Analytics Engineer
- Data Engineer
- Data Scientist
- ML Engineer
- AI Engineer
ordersTable35 rows
| Column Name | Type |
|---|---|
| order_id | BIGINT |
| customer_id | BIGINT |
| order_date | DATE |
| status | VARCHAR |
| amount | DOUBLE |
ordersExample Input
| order_id | customer_id | order_date | status | amount |
|---|---|---|---|---|
| 1001 | 1 | 2024-01-05 | completed | 120.5 |
| 1002 | 2 | 2024-01-07 | completed | 2400 |
| 1004 | 3 | 2024-01-15 | canceled | 45 |
| 1008 | 1 | 2024-02-02 | refunded | 75 |
| 1017 | 6 | 2024-03-08 | canceled | 62 |
| 1026 | 3 | 2024-04-13 | refunded | 88 |
Example Output
| order_id | status | amount |
|---|---|---|
| 1008 | refunded | 75 |
| 1017 | canceled | 62 |
| 1026 | refunded | 88 |
Explanation
Orders 1008, 1017 and 1026 were refunded or canceled, and each was worth more than 50. Order 1004 was also canceled, but it was worth only 45, so the team does not follow up on it.
The example above is a small slice of the data. Your query runs against the full tables.
Company
Target
Difficulty
easy
Topic
logical operators
Your query
Starting the SQL engine...