SQL AVG Function - SQL Server Avg() Function
The SQL AVG() Function
- The AVG() function computes the average value of a numeric column by summing all values and dividing by the total count of values, commonly used in databases for statistical analysis.
Demo Database
- Here is a segment extracted from the Wikitechy table as referenced in the examples provided:
Syntax
SELECT AVG(column_name) FROM table_name;
- Calculate the average price of all products listed in the database to gain insights into the overall pricing structure.
Example
SELECT AVG(Mark) FROM Wikitechy;