Write SQL and Python, run instantly in your browser, and track your progress.
You are a Payments Risk Analyst at Shopify. The Finance and Risk teams are investigating payment failures to identify customers who may be experiencing payment issues or attempting fraudulent orders. These customers have placed orders but none of their payments have been successfully captured, which could indicate declined cards, insufficient funds, or potential fraud attempts.
Your task is to identify all customers who have placed at least one order but have never had a payment successfully captured. This will help the team reach out to legitimate customers experiencing payment problems while flagging potentially fraudulent accounts.
| Column Name | Type |
|---|---|
| order_id | INTEGER |
| order_number | TEXT |
| customer_id |
You are a Payments Risk Analyst at Shopify. The Finance and Risk teams are investigating payment failures to identify customers who may be experiencing payment issues or attempting fraudulent orders. These customers have placed orders but none of their payments have been successfully captured, which could indicate declined cards, insufficient funds, or potential fraud attempts.
Your task is to identify all customers who have placed at least one order but have never had a payment successfully captured. This will help the team reach out to legitimate customers experiencing payment problems while flagging potentially fraudulent accounts.
| Column Name | Type |
|---|---|
| order_id | INTEGER |
| order_number | TEXT |
| customer_id |
| INTEGER |
| INTEGER |
| status | TEXT |
| status | TEXT |
| total_amount | REAL |
| total_amount | REAL |
| payment_status | TEXT |
| payment_status | TEXT |
| Column Name | Type |
|---|---|
| payment_id | INTEGER |
| order_id | INTEGER |
| method | TEXT |
| amount | REAL |
| status | TEXT |
| Column Name | Type |
|---|---|
| payment_id | INTEGER |
| order_id | INTEGER |
| method | TEXT |
| amount | REAL |
| status | TEXT |
| order_id | order_number | customer_id | status | total_amount | payment_status |
|---|---|---|---|---|---|
| 1 | ORD-10001 | 46 | shipped | 55.32 | captured |
| 2 | ORD-10002 | 19 |
| order_id | order_number | customer_id | status | total_amount | payment_status |
|---|---|---|---|---|---|
| 1 | ORD-10001 | 46 | shipped | 55.32 | captured |
| 2 | ORD-10002 | 19 |
| payment_id | order_id | method | amount | status |
|---|---|---|---|---|
| 1 | 1 | apple_pay | 55.32 | captured |
| 2 | 2 | google_pay | 662.48 | partial_refund |
| payment_id | order_id | method | amount | status |
|---|---|---|---|---|
| 1 | 1 | apple_pay | 55.32 | captured |
| 2 | 2 | google_pay | 662.48 | partial_refund |
| customer_id |
|---|
| 11 |
| 15 |
| 18 |
| 19 |
| 20 |
| customer_id |
|---|
| 11 |
| 15 |
| 18 |
| 19 |
| 20 |
Showing first 5 of 11 rows. These customers have orders but no payments with status 'captured'.
Showing first 5 of 11 rows. These customers have orders but no payments with status 'captured'.
1. Output Columns:
2. Set Operation Logic:
3. Edge Cases:
4. Ordering:
1. Output Columns:
2. Set Operation Logic:
3. Edge Cases:
4. Ordering:
| delivered |
| delivered |
| 662.48 |
| 662.48 |
| partial_refund |
| partial_refund |
| 3 | ORD-10003 | 21 | shipped | 88.66 | captured |
| 3 | ORD-10003 | 21 | shipped | 88.66 | captured |
| 4 | ORD-10004 | 8 | shipped | 322.87 | captured |
| 4 | ORD-10004 | 8 | shipped | 322.87 | captured |
| 5 | ORD-10005 | 8 | packed | 629.34 | captured |
| 5 | ORD-10005 | 8 | packed | 629.34 | captured |
| 3 |
| 3 |
| 3 |
| 3 |
| bank_transfer |
| bank_transfer |
| 88.66 |
| 88.66 |
| captured |
| captured |
| 4 | 4 | card | 322.87 | captured |
| 4 | 4 | card | 322.87 | captured |
| 5 | 5 | bank_transfer | 629.34 | captured |
| 5 | 5 | bank_transfer | 629.34 | captured |