From the course: SQL for Non-Programmers

Unlock the full course today

Join today to access over 23,100 courses taught by industry experts.

Challenge: Practice with aggregate functions

Challenge: Practice with aggregate functions - SQL Tutorial

From the course: SQL for Non-Programmers

Challenge: Practice with aggregate functions

Management is back again with a new request and they need our help fast. We have been called to prepare a performance report of Two Trees Olive Oil priority states, a list of the states with six employees assigned, and those that have brought in over $40,000 in sales. They need this report to include the employee count and all sales of the business for each state, as well as an additional version that only considers sales to business customers. Make sure to order both reports from largest to smallest sales total. Are you up for the challenge? Let's break this down into a step-by-step approach. First, find the unique number of employees working for each state. Now, add the sum of total ordered sales by state to your query and order by largest to smallest order total. We need to consider only priority states that have six employees assigned and made over 40,000 in order sales. How can we include this group filter in our query? Once you prepare your query and execute, how many states…

Contents