Write SQL and Python, run instantly in your browser, and track your progress.
You are a Business Intelligence Analyst at Amazon. The Operations team needs a comprehensive view of order performance by status. For each order status, calculate the count of orders, total revenue, and average order value.
| Column Name | Type |
|---|---|
| order_id | int64 |
| order_number | object |
| customer_id | int64 |
| order_datetime | object |
You are a Business Intelligence Analyst at Amazon. The Operations team needs a comprehensive view of order performance by status. For each order status, calculate the count of orders, total revenue, and average order value.
| Column Name | Type |
|---|---|
| order_id | int64 |
| order_number | object |
| customer_id | int64 |
| order_datetime | object |
| status | object |
| status | object |
| total_amount | float64 |
| total_amount | float64 |
| payment_status | object |
| payment_status | object |
| order_id | order_number | customer_id | order_datetime | status | total_amount | payment_status |
|---|---|---|---|---|---|---|
| 1 | ORD-10001 | 46 | 2025-08-20 07:01:34 | shipped | 55.32 | captured |
| 2 |
| order_id | order_number | customer_id | order_datetime | status | total_amount | payment_status |
|---|---|---|---|---|---|---|
| 1 | ORD-10001 | 46 | 2025-08-20 07:01:34 | shipped | 55.32 | captured |
| 2 |
| status | order_count | total_revenue | avg_order_value |
|---|---|---|---|
| delivered | 22 | 10726.68 | 487.58 |
| shipped | 20 | 10625.81 | 531.29 |
| confirmed | 11 | 6965.86 | 633.26 |
| returned | 6 | 4344.15 | 724.02 |
| status | order_count | total_revenue | avg_order_value |
|---|---|---|---|
| delivered | 22 | 10726.68 | 487.58 |
| shipped | 20 | 10625.81 | 531.29 |
| confirmed | 11 | 6965.86 | 633.26 |
| returned | 6 | 4344.15 | 724.02 |
Showing first 5 of 8 rows.
Showing first 5 of 8 rows.
1. Grouping:
2. Aggregation:
3. Output:
1. Grouping:
2. Aggregation:
3. Output:
| ORD-10002 |
| ORD-10002 |
| 19 |
| 19 |
| 2025-02-24 04:56:03 |
| 2025-02-24 04:56:03 |
| delivered |
| delivered |
| 662.48 |
| 662.48 |
| partial_refund |
| partial_refund |
| 3 | ORD-10003 | 21 | 2025-02-13 17:43:43 | shipped | 88.66 | captured |
| 3 | ORD-10003 | 21 | 2025-02-13 17:43:43 | shipped | 88.66 | captured |
| 4 | ORD-10004 | 8 | 2025-02-07 13:00:50 | shipped | 322.87 | captured |
| 4 | ORD-10004 | 8 | 2025-02-07 13:00:50 | shipped | 322.87 | captured |
| 5 | ORD-10005 | 8 | 2025-06-24 03:59:58 | packed | 629.34 | captured |
| 5 | ORD-10005 | 8 | 2025-06-24 03:59:58 | packed | 629.34 | captured |
| packed | 4 | 3480.01 | 870 |
| packed | 4 | 3480.01 | 870 |