Aggregate Functions :
-> Avg(numeric) returns numeric
-> Min(numeric) returns numeric
-> Max(numeric) returns numeric
-> sum(numeric) returns numeric
-> count(one column name or *) --this function will give total number of matched rows count.
-> T-SQL will not support nested aggregate functions.
-> Aggregate functions must not be used in where clause.
Query to display average salary of all employees
-> select avg(salary) as 'avgsal' from employees.
Query for displaying min,max and average salary and sum of all employees salary.
-> select min(salary),max(salary),avg(salary),sum(salary) from employees.
Query to display minimum,maximum and average salary of .net employees.
-> select min(salary),max(salary),avg(salary) from employees where dept .net
This function is use full for identifying total number of rows present in the final intermediate result sets.
Ex: select count * from employees
select count(eid) from employees
Query to display total number of android department employees.
-> select count (*) from employees where dept='android'
Query to display total number of employees count whose fnames are having character 'a' anywhere
-> select count(*) from employees where fname like '%a%'
Query to display the employee details whose salaries are greater than average .net department employees salary.