Chapter 10. Aggregate Functions and Clauses
It is not overstating things to say that MySQL queries can return a significant amount of data. As we have seen with the
SELECT statement, using clauses such as
WHERE reduces the number of hits that MySQL returns. Similarly, one can reduce the amount of data returned by specifying the columns to be returned. Such features save us from having to write our own algorithms to weed through the data. However, even after narrowing the data, we sometimes still need to perform calculations with the data for purposes such as tallying a sum, averaging out results, or finding the range of a dataset. MySQL saves us this trouble as well, by providing functions that return the answers to our questions without bothering ...