Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Application Development And Administration

Authors: Mannino Michael

5th Edition

0983332401, 978-0983332404

More Books

Students also viewed these Databases questions

Question

How is an agent middleman different from a merchant middleman?

Answered: 1 week ago