Write SQL and Python, run instantly in your browser, and track your progress.
You are a Financial Analyst at Walmart. The Finance team needs quarterly revenue summaries for board reporting. Extract the quarter from each order's datetime and calculate total revenue by year and quarter.
| Column Name | Type |
|---|---|
| order_id | int64 |
| order_datetime | object |
| status | object |
| total_amount | float64 |
You are a Financial Analyst at Walmart. The Finance team needs quarterly revenue summaries for board reporting. Extract the quarter from each order's datetime and calculate total revenue by year and quarter.
| Column Name | Type |
|---|---|
| order_id | int64 |
| order_datetime | object |
| status | object |
| total_amount | float64 |
| order_id | order_datetime | status | total_amount |
|---|---|---|---|
| 1 | 2025-08-20 07:01:34 | shipped | 55.32 |
| 2 | 2025-02-24 04:56:03 | delivered | 662.48 |
| 3 | 2025-02-13 17:43:43 | shipped |
| order_id | order_datetime | status | total_amount |
|---|---|---|---|
| 1 | 2025-08-20 07:01:34 | shipped | 55.32 |
| 2 | 2025-02-24 04:56:03 | delivered | 662.48 |
| 3 | 2025-02-13 17:43:43 | shipped |
| order_year | order_quarter | total_revenue | order_count |
|---|---|---|---|
| 2024 | 3 | 4548.43 | 5 |
| 2024 | 4 | 15124.71 | 24 |
| 2025 | 1 | 11535.49 | 19 |
| 2025 | 2 | 8032.71 | 15 |
| order_year | order_quarter | total_revenue | order_count |
|---|---|---|---|
| 2024 | 3 | 4548.43 | 5 |
| 2024 | 4 | 15124.71 | 24 |
| 2025 | 1 | 11535.49 | 19 |
| 2025 | 2 | 8032.71 | 15 |
5 rows returned.
5 rows returned.
1. Data Selection:
2. DateTime Operations:
3. Output:
1. Data Selection:
2. DateTime Operations:
3. Output:
| 88.66 |
| 88.66 |
| 4 | 2025-02-07 13:00:50 | shipped | 322.87 |
| 4 | 2025-02-07 13:00:50 | shipped | 322.87 |
| 5 | 2025-06-24 03:59:58 | packed | 629.34 |
| 5 | 2025-06-24 03:59:58 | packed | 629.34 |
| 6 | 2025-04-08 22:29:42 | delivered | 233.31 |
| 6 | 2025-04-08 22:29:42 | delivered | 233.31 |
| 2025 | 3 | 4601.85 | 12 |
| 2025 | 3 | 4601.85 | 12 |