From the course: SQL Essential Training

Unlock the full course today

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

Grouping with the HAVING clause

Grouping with the HAVING clause - SQL Tutorial

From the course: SQL Essential Training

Grouping with the HAVING clause

- [Instructor] Now, in our last example, we were able to include the WHERE clause and apply filtering to our non-aggregated field. In other words, you were able to filter down to only the cities that started with L by way of our WHERE clause which was applied to the billing city which in our example here is the non-aggregated field. Now, at the same time, there are times where we will need to use criteria on fields that have been aggregated, for instance, like our average total here. So let's say we have a new twist in the request from WSDA Music Management. They have now asked us to find all average totals that are greater than $5. How would we go about doing this? But first, let's update our question. We want all average invoice totals greater than five bucks and let's include our dollar sign there. Okay, what are the average invoice totals that are greater than $5? Now, this is just an alteration of our present WHERE…

Contents