Nimbus Retail wants to identify its top-performing sales region for Q1 2024. Write a SQL query to find the region with the highest total completed sales amount during that period.
Requirements
- Use only orders with
status = 'completed'.
- Include only orders with
order_date from 2024-01-01 through 2024-03-31.
- Sum
amount by region using the customer-to-region mapping.
- Return the single top-performing region with its total revenue.
Table definitions
regions
| column | type | description |
|---|
| region_id | INT | Primary key for each region |
| region_name | VARCHAR(50) | Region name |
customers
| column | type | description |
|---|
| customer_id | INT | Primary key for each customer |
| customer_name | VARCHAR(100) | Customer name |
| region_id | INT | Customer's assigned region |
orders
| column | type | description |
|---|
| order_id | INT | Primary key for each order |
| customer_id | INT | Customer placing the order |
| order_date | DATE | Date of the order |
| amount | DECIMAL(10,2) | Order amount |
| status | VARCHAR(20) | Order status |