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 WHERE clause

Grouping with the WHERE clause - SQL Tutorial

From the course: SQL Essential Training

Grouping with the WHERE clause

- [Instructor] Now it is possible to add criteria to queries that we've applied grouping to. Adding criteria to a group query works in the same way as with other queries that we've seen before. Using the Where clause allows us to add new criteria. So let's consider a alteration of our original request by WSDA Music Management. They have now asked us what are the average invoice totals by city for only the cities that start with L. Now we can achieve the result of this request by making some alterations to our existing SQL statement. Let's go ahead and add a Where clause to our query. And the Where clause always comes after the From clause and before the Group By. So let's go ahead and add Where and now we are interested in a subset of this data. We are now only interested in the billing cities that start with L. So let's include BillingCity and we just want to perform a partial search. So to do this, we include the Like…

Contents