Databases Reference
In-Depth Information
Table 6-7: SQL Server Aggregate Functions
Function
Return Data Type
Description
AVG
Number (real)
Calculates average for a range of
numeric values.
COUNT
Int
Returns number of rows in a
SELECT statement.
COUNT_BIG
Bigint
Returns number of rows in a
SELECT statement based on a
bigint type value.
MAX
Number (real)
Returns max value among selected
values.
MIN
Number (real)
Returns min value among
selected values.
SUM
Number (real)
Calculates sum of the selected
values.
The SALES table shows the lifetime quantity of particular products sold by
particular salespersons. For example, the first row indicates that Salesperson 137
has sold 473 units of Product Number 19440 dating back to when she joined
the company or when the product was introduced.
Figure 6-5
SALES table
SPNUM
PRODNUM
QUANTITY
137
137
137
186
186
186
186
204
204
361
361
361
19440
24013
26722
16386
19440
21765
24013
21765
26722
16386
21765
26722
473
170
688
1745
2529
1962
3071
809
734
3729
3110
2738
SALES table.
Search WWH ::




Custom Search