AVG (SQL)
A window function that assigns the average of the values in the field column for rows within the specified window frame to all rows in that window frame.
Synopsis
AVG(field)
Description
AVG returns the average of the values in a specified column for rows within the specified window frame to all rows in that window frame. AVG supports the ROWS clause.
This window function works analogously to the aggregate function AVG.
Arguments
field
A column that specifies the rows of values to be averaged.
Examples
The following example compares each employee's salary against the average of the salaries earned by employees within that employee's department:
SELECT AVG(Salary) OVER (PARTITION BY Department) FROM Company.Employee
See Also
-
Aggregate functions: AVG