- what is the total retail sales for each supplier?
QUERY:
select supplier, sum(retailsales) as total_retail_sales
from project
group by supplier;
RESULT:
- what is the total retail sales for each combination of supplier and month
QUERY:
select supplier, year, month, sum(retailsales) as total_retail_sales
from project
group by supplier, year, month;
RESULT:
- what is the maximum warehouse sales for each item description?
QUERY:
select itemdescription, max(retailsales) as max_warehouse_sales
from project
group by itemdescription;
RESULT:
- what is the average retail transfer for each year
QUERY:
select year, avg(retailtransfers) as avg_retail_transfers
from project
group by year;
RESULT:
- for each item description, what is the difference between the maximum and minimum retail sales? QUERY:
select itemdescription, max(retailsales) - min(retailsales) as diff_max_min_retail_sales
from project
group by itemdescription;
RESULT:
- what is the total retail sales for each supplier, broken down by year and month
QUERY:
select year, month, supplier,
sum(retailsales) over (partition by supplier, year, month) as total_retail_sales
from project;
- what is the running total of retail sales for each item type, order by month? QUERY:
select year, month, itemtype,
sum(retailsales) over (partition by itemtype order by month) as running_total_retail_sales
from project;
RESULT:
- what is the difference in retail sales between each month and the previous month, for each supplier and item type? QUERY:
select year, month, supplier, itemtype,
retailsales - lag(retailsales) over (partition by supplier, itemtype order by year, month) as diff_retail_sales
from project;
RESULT:
- what is the average retail sales for each item type compared to the overall average retail sales across all item types for each year?
- What is the percentage of retail sales for each supplier, compared to the total retail sales across all suppliers, broken down by year and month?
- What is the month with the highest retail transfer for each supplier, for the past 12 months?
NOTE: This is just a sample of the query and results