Write SQL and Python, run instantly in your browser, and track your progress.
You are a Data Analyst at Shopify. Marketing wants to identify customers who have never placed an order for a re-engagement campaign. Use a left join to get all customers and count how many orders each has placed, including customers with zero orders.
| Column Name | Type |
|---|---|
| customer_id | int64 |
| full_name | object |
| object | |
| phone | object |
You are a Data Analyst at Shopify. Marketing wants to identify customers who have never placed an order for a re-engagement campaign. Use a left join to get all customers and count how many orders each has placed, including customers with zero orders.
| Column Name | Type |
|---|---|
| customer_id | int64 |
| full_name | object |
| object | |
| phone | object |
| city | object |
| city | object |
| state | object |
| state | object |
| country | object |
| country | object |
| created_at | object |
| created_at | object |
| Column Name | Type |
|---|---|
| order_id | int64 |
| order_number | object |
| customer_id | int64 |
| order_datetime | object |
| status | object |
| total_amount | float64 |
| Column Name | Type |
|---|---|
| order_id | int64 |
| order_number | object |
| customer_id | int64 |
| order_datetime | object |
| status | object |
| total_amount | float64 |
| customer_id | full_name | phone | city | state | country | created_at | |
|---|---|---|---|---|---|---|---|
| 1 | Sophia Lewis | sophia.lewis@gmail.com | San Diego | CA | US | 2024-10-10 |
| customer_id | full_name | phone | city | state | country | created_at | |
|---|---|---|---|---|---|---|---|
| 1 | Sophia Lewis | sophia.lewis@gmail.com | San Diego | CA | US | 2024-10-10 |
| order_id | order_number | customer_id | order_datetime | status | total_amount | payment_status |
|---|---|---|---|---|---|---|
| 1 | ORD-10001 | 1 | 2025-01-15 | delivered | 125.50 | captured |
| 2 |
| order_id | order_number | customer_id | order_datetime | status | total_amount | payment_status |
|---|---|---|---|---|---|---|
| 1 | ORD-10001 | 1 | 2025-01-15 | delivered | 125.50 | captured |
| 2 |
| customer_id | full_name | order_count |
|---|---|---|
| 1 | Sophia Lewis | 2 |
| 2 | Marilyn Kelly | 1 |
| 3 | Andrea Miller | 2 |
| 4 | Luis Green | 0 |
| 5 | Anthony Alvarez | 0 |
| customer_id | full_name | order_count |
|---|---|---|
| 1 | Sophia Lewis | 2 |
| 2 | Marilyn Kelly | 1 |
| 3 | Andrea Miller | 2 |
| 4 | Luis Green | 0 |
| 5 | Anthony Alvarez | 0 |
Showing first 5 of 50 rows.
Showing first 5 of 50 rows.
1. DataFrames:
2. Merge:
3. Aggregation:
4. Output:
1. DataFrames:
2. Merge:
3. Aggregation:
4. Output:
| payment_status | object |
| payment_status | object |
| 2 | John Smith | john.smith@yahoo.com | Austin | TX | US | 2024-11-05 |
| 2 | John Smith | john.smith@yahoo.com | Austin | TX | US | 2024-11-05 |
| 3 | Maria Garcia | maria.garcia@outlook.com | Miami | FL | US | 2024-12-01 |
| 3 | Maria Garcia | maria.garcia@outlook.com | Miami | FL | US | 2024-12-01 |
| ORD-10002 |
| ORD-10002 |
| 1 |
| 1 |
| 2025-02-20 |
| 2025-02-20 |
| shipped |
| shipped |
| 89.99 |
| 89.99 |
| captured |
| captured |
| 3 | ORD-10003 | 3 | 2025-03-10 | processing | 45.00 | pending |
| 3 | ORD-10003 | 3 | 2025-03-10 | processing | 45.00 | pending |