From the course: SQL for Non-Programmers
Unlock the full course today
Join today to access over 23,400 courses taught by industry experts.
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
Getting started with aggregate functions6m 59s
-
(Locked)
Making aggregate functions work for you5m 35s
-
(Locked)
Group data using GROUP BY6m 26s
-
(Locked)
Filter on groups of data with HAVING4m 36s
-
(Locked)
Challenge: Practice with aggregate functions1m 38s
-
(Locked)
Solution: Aggregate functions solved5m 6s
-
-
-
-