MySQL Aggregate Functions With Example - Mysql Views : 243
Tagged in : Mysql
0 0
Send mail

MySQL Aggregate Functions With Example


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
By Geethalakshmi, On - 2010-09-29



    Login to add Comments .