Categorize Sales
Start Timer
0:00:00
An electronics retail company tracks its sales and wants to run a performance analysis. They’re hoping to categorize sales into different groups, based on the amount of sales and the region where the sale occurred. The conditions for categorization are:
- Standard Sales: Any sales below 2000 are considered standard, except if they occur in the
Eastregion, or in the month of July. - Premium Sales: Any sales that are over or equal to 2000, or any sales in the
Eastregion (regardless of the amount), are considered premium, except again during the month of July. - Promotional Sales: All sales made in the promotional period of July, regardless of the amount or region, are considered promotional.
The company wants a report that sums these amounts by region to help with financial planning and bonus allocations.
Note: You may assume that table contains data only for 2023
Example:
Input:
sales table
| Column | Type |
|---|---|
sale_id |
INTEGER |
employee_id |
INTEGER |
product_id |
INTEGER |
sale_amount |
FLOAT |
sale_date |
DATE |
region |
TEXT |
Output:
| Column | Type |
|---|---|
region |
TEXT |
total_sales |
FLOAT |
premium_sales |
FLOAT |
standard_sales |
FLOAT |
promotional_sales |
FLOAT |
.
.
.
.
.
.
.
.
.
Comments