April 2002
Intermediate to advanced
416 pages
11h 50m
English
Aggregate functions perform an operation on a group of values taken from a series of records. For example, the AVG function computes the average of a field’s value over the selected records. The following statement calculates the average Score value for records with StudentId value 1001:
SELECT AVG(Score) FROM Scores WHERE StudentId = 1001
Table A.3 describes aggregate functions available in SQL Server.
| Function | Purpose |
|---|---|
| AVG | Calculates the average of the selected values. |
| COUNT | Returns the number of selected records. |
| MAX | Returns the largest value selected. |
| MIN | Returns the smallest value selected. |
| SUM | Returns the sum of the selected values. |
| STDEV | Calculates the statistical standard deviation ... |
Read now
Unlock full access