Write SQL and Python, run instantly in your browser, and track your progress.
You are a Customer Retention Analyst at Amazon. The team needs to identify recently active buyers who have completed successful purchases within the last 60 days. These customers represent high-engagement segments for targeted marketing campaigns, loyalty program enrollment, and personalized product recommendations based on their recent purchase behavior.
| Column Name | Type |
|---|---|
| customer_id | INTEGER |
| full_name | TEXT |
| TEXT | |
| phone |
You are a Customer Retention Analyst at Amazon. The team needs to identify recently active buyers who have completed successful purchases within the last 60 days. These customers represent high-engagement segments for targeted marketing campaigns, loyalty program enrollment, and personalized product recommendations based on their recent purchase behavior.
| Column Name | Type |
|---|---|
| customer_id | INTEGER |
| full_name | TEXT |
| TEXT | |
| phone |
| TEXT |
| TEXT |
| city | TEXT |
| city | TEXT |
| state | TEXT |
| state | TEXT |
| country | TEXT |
| country | TEXT |
| created_at | TEXT |
| created_at | TEXT |
| customer_id | full_name | phone | city | state | country | created_at | |
|---|---|---|---|---|---|---|---|
| 1 | Sophia Lewis | sophia.lewis@gmail.com | San Diego | CA | US | 2024-10-10 19:19:27 |
| customer_id | full_name | phone | city | state | country | created_at | |
|---|---|---|---|---|---|---|---|
| 1 | Sophia Lewis | sophia.lewis@gmail.com | San Diego | CA | US | 2024-10-10 19:19:27 |
| Column Name | Type |
|---|---|
| order_id | INTEGER |
| order_number | TEXT |
| customer_id | INTEGER |
| order_datetime | TEXT |
| status | TEXT |
| fulfillment_type | TEXT |
| Column Name | Type |
|---|---|
| order_id | INTEGER |
| order_number | TEXT |
| customer_id | INTEGER |
| order_datetime | TEXT |
| status | TEXT |
| fulfillment_type | TEXT |
| order_id | order_number | customer_id | order_datetime | status | fulfillment_type | ship_city | ship_state | ship_country | shipping_service_level | subtotal | shipping_fee | tax | discount | total_amount |
|---|
| order_id | order_number | customer_id | order_datetime | status | fulfillment_type | ship_city | ship_state | ship_country | shipping_service_level | subtotal | shipping_fee | tax | discount | total_amount |
|---|
| customer_id | last_activity |
|---|---|
| 239 | 2025-08-28 23:16:19 |
| 157 | 2025-08-26 20:20:06 |
| 143 | 2025-08-22 10:36:28 |
| customer_id | last_activity |
|---|---|
| 239 | 2025-08-28 23:16:19 |
| 157 | 2025-08-26 20:20:06 |
| 143 | 2025-08-22 10:36:28 |
Showing first 3 of 28 rows.
Showing first 3 of 28 rows.
Output Requirements:
Business Logic:
Time Window:
Output Requirements:
Business Logic:
Time Window:
| 2 | Marilyn Kelly | marilynkelly@yahoo.com | New York | NY | US | 2024-11-30 08:33:24 |
| 2 | Marilyn Kelly | marilynkelly@yahoo.com | New York | NY | US | 2024-11-30 08:33:24 |
| 3 | Andrea Miller | andrea_miller@zoho.com | +1-803-484-1106 | Winnipeg | MB | CA | 2025-06-22 16:35:50 |
| 3 | Andrea Miller | andrea_miller@zoho.com | +1-803-484-1106 | Winnipeg | MB | CA | 2025-06-22 16:35:50 |
| 4 | Luis Green | lgreen@aol.com | +1-544-304-2519 | San Antonio | TX | US | 2025-01-26 13:10:44 |
| 4 | Luis Green | lgreen@aol.com | +1-544-304-2519 | San Antonio | TX | US | 2025-01-26 13:10:44 |
| 5 | Anthony Alvarez | anthonya@protonmail.com | +1-749-327-7201 | Los Angeles | CA | US | 2024-10-01 14:28:15 |
| 5 | Anthony Alvarez | anthonya@protonmail.com | +1-749-327-7201 | Los Angeles | CA | US | 2024-10-01 14:28:15 |
| ship_city | TEXT |
| ship_city | TEXT |
| ship_state | TEXT |
| ship_state | TEXT |
| ship_country | TEXT |
| ship_country | TEXT |
| shipping_service_level | TEXT |
| shipping_service_level | TEXT |
| subtotal | REAL |
| subtotal | REAL |
| shipping_fee | REAL |
| shipping_fee | REAL |
| tax | REAL |
| tax | REAL |
| discount | REAL |
| discount | REAL |
| total_amount | REAL |
| total_amount | REAL |
| payment_status | TEXT |
| payment_status | TEXT |
| created_at | TEXT |
| created_at | TEXT |
| payment_status |
|---|
| payment_status |
|---|
| created_at |
|---|
| created_at |
|---|
| 1 | ORD-10001 | 46 | 2025-08-20 07:01:34 | shipped | pickup | pickup | 50.96 | 0.0 | 4.36 | 0.0 | 55.32 | captured | 2025-08-20 07:01:34 | |||
| 2 | ORD-10002 | 19 | 2025-02-24 04:56:03 | delivered | ship |
| 1 | ORD-10001 | 46 | 2025-08-20 07:01:34 | shipped | pickup | pickup | 50.96 | 0.0 | 4.36 | 0.0 | 55.32 | captured | 2025-08-20 07:01:34 | |||
| 2 | ORD-10002 | 19 | 2025-02-24 04:56:03 | delivered | ship |
| Austin |
| Austin |
| TX |
| TX |
| US |
| US |
| economy |
| economy |
| 601.53 |
| 601.53 |
| 5.99 |
| 5.99 |
| 54.96 |
| 54.96 |
| 0.0 |
| 0.0 |
| 662.48 |
| 662.48 |
| partial_refund |
| partial_refund |
| 2025-02-24 04:56:03 |
| 2025-02-24 04:56:03 |
| 3 | ORD-10003 | 21 | 2025-02-13 17:43:43 | shipped | ship | London | ENG | UK | expedited | 68.26 | 14.99 | 5.41 | 0.0 | 88.66 | captured | 2025-02-13 17:43:43 |
| 3 | ORD-10003 | 21 | 2025-02-13 17:43:43 | shipped | ship | London | ENG | UK | expedited | 68.26 | 14.99 | 5.41 | 0.0 | 88.66 | captured | 2025-02-13 17:43:43 |
| 4 | ORD-10004 | 8 | 2025-02-07 13:00:50 | shipped | ship | Calgary | AB | CA | standard | 290.99 | 5.0 | 26.88 | 0.0 | 322.87 | captured | 2025-02-07 13:00:50 |
| 4 | ORD-10004 | 8 | 2025-02-07 13:00:50 | shipped | ship | Calgary | AB | CA | standard | 290.99 | 5.0 | 26.88 | 0.0 | 322.87 | captured | 2025-02-07 13:00:50 |
| 5 | ORD-10005 | 8 | 2025-06-24 03:59:58 | packed | ship | Edmonton | AB | CA | standard | 569.61 | 5.0 | 54.73 | 0.0 | 629.34 | captured | 2025-06-24 03:59:58 |
| 5 | ORD-10005 | 8 | 2025-06-24 03:59:58 | packed | ship | Edmonton | AB | CA | standard | 569.61 | 5.0 | 54.73 | 0.0 | 629.34 | captured | 2025-06-24 03:59:58 |