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 and HAVING clause

Grouping with the WHERE and HAVING clause - SQL Tutorial

From the course: SQL Essential Training

Grouping with the WHERE and HAVING clause

- Now a simple way of explaining the difference between the WHERE versus the HAVING clause is the WHERE clause is for filtering non aggregate data and the HAVING is for filtering results that contain aggregates. Now, a more detailed way to describe this difference is that two types of filtering occur when both a WHERE and a HAVING clause are included in the same query. The WHERE clause tells the query what information to include from the table. Then once the information is filtered and aggregate functions are applied to the fields the HAVING clause acts as a further filter for the aggregated data. Now, let's take a look at this and add a little twist to our current request from WSDA Music management. They would now want the exact result that we have here but only for the cities that start with B. So let's alter our question here. What are the average invoice totals greater than $5 for cities starting…

Contents