April 2007
Intermediate to advanced
1032 pages
19h 28m
English
The GROUP BY clause groups rows on the basis of similarities among them. For example, we could group all the rows in the PLAYERS table on the basis of the place of residence. The result would be one group of players per town. From there, we could query the number of players in each group. The final result answers the question, how many players live in each town? Other examples are: How many matches has each team played, and how much has each player incurred in penalties? In short, the GROUP BY clause is frequently used to formulate questions based on the word per.
By adding aggregation functions, such as COUNT and SUM, to a select block with the use of a GROUP BY clause, data ...
Read now
Unlock full access