Sum, Average, Min/Max Queries
Both the sum and average queries can help us summarize and analyze numerical data in a table.
Total Sum
The SUM()
function returns the total sum of a numeric column.
It is useful when calculating how many records from an attribute fits your given condition.
SUM()
Query Format
SUM()
Query FormatAverage of an Attribute
The AVG()
function returns the average value of a numeric column.
AVG()
Query Format
AVG()
Query FormatUse Cases for SUM()
and AVG()
SUM()
and AVG()
Let us assume that we have the following table:
Products(ProductID, Name, Price, Sold)
The sum query can be used to output number of products sold so far in the table
The average query can be used to output the average price of all items in the table
Minimum and Maximum from an Attribute
The MIN()
function returns the smallest value of the selected column.
The MAX()
function returns the largest value of the selected column.
Query Format
Last updated