May 2020
Beginner
564 pages
14h 9m
English
You can also use the WHERE and HAVING clauses in the same query, and each has its specific uses. The following table outlines each. side by side:
| HAVING | WHERE |
| Filters on aggregated data | Filters on row data |
| Happens after aggregation | Happens before aggregation |
For example, in a previous query of Learning how to use the HAVING clause to limit query results section, you were getting any aggregated at-bat results that were between 100 and 400. However, this would mean that MySQL is aggregating results that wouldn't even get summed, such as rows that have zero or NULL, so you would want to filter out those rows so they won't be counted. You can execute the following ...
Read now
Unlock full access