Aggregate functions in MySQL are a group of functions that are used to operate on a set of values. These functions ignore NULL values unless specified. Functions like AVG(), MIN(), MAX(), COUNT() etc fall under this category. As they operate on a set of values, if no Group by clause is used, it applies to all rows.
AVG()
Returns the average of the parameter passed. Returns 0 if no matching rows found.
Example:
Avg(salary)
COUNT()
Counts the number of NON NULL values of the parameter passed. Returns 0 if no matching rows found.
Example:
Select employee_id, COUNT(*) from table_name;
MAX()
Returns the maximum value of the parameter passed. Returns 0 if no matching rows found.
Example:
Select MAX(employee_salary) from table_name
MIN()
Returns the minimun value of the parameter passed. Returns 0 if no matching rows found.
Example:
Select MIN(employee_salary) from table_name
SUM()
Returns the sum of the parameter passed. Returns NULL if no matching rows found.
Example:
Select SUM(employee_salary) from table_name