Aggregrate function is a function which returns single value by performing a calculation on a set of values.MySQL provides many aggregate functions such as AVG, COUNT, SUM, MIN, MAX, etc.
MIN returns the smallest value in a given column
MIN(expression)
SELECT MIN(marks) FROM result
MAX returns the largest value in a given column
MAX(expression)
SELECT MAX(marks) FROM result
SUM returns the sum of the numeric values in a given column
SELECT productCode,sum(priceEach * quantityOrdered) total
FROM orderdetails GROUP by productCode
AVG returns the average value of a given column
SELECT AVG(marks) FROM result
AVG(expression)
COUNT returns the total number of values in a given column
COUNT(*) returns the number of rows in a table
COUNT(DISTINCT expression)
example:
SELECT COUNT(*) AS totalprice FROM pricetable
0 Comment(s)