Question: For database im having a hard time with my code , What is the average sale amount for each sale reps in each office. Null

For database im having a hard time with my code , What is the average sale amount for each sale reps in each office. Null should be ignored
SELECT salesrep, office, AVG(sale) AS avg_sale
FROM orders
WHERE sale IS NOT NULL
GROUP BY salesrep, office;
For each salesrep that has made an order, list the minimum, maximum and average order amount for all their orders. Include only those orders made anytime from 2020-2021. Omit from the list any salesrep that has only made 1 order in this time frame. Sort the results by Empl_Num.
SELECT empl_num, MIN(amount) AS MinAmount, MAX(amount) AS MaxAmount, AVG(amount) AS AvgAmount
FROM orders
WHERE order_date >='2020-01-01' AND order_date <'2022-01-01'
GROUP BY empl_num
HAVING COUNT(*)>1
ORDER BY empl_num;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!