SQL Aggregate Functions
Following are the most
used Sql aggregate functions
MAX()
MIN()
AVG()
SUM()
COUNT()
Here is the brief description about the each
function.
MAX() Function
The MAX() function
returns the largest value of the selected column.
SQL MAX() Syntax :
select max(salary) from Sal
MIN() Function
The MIN() function
returns the smallest value of the selected column.
Syntax:
select min(salary) from Sal
AVG() Function
The AVG() function returns the average value of a numeric column.
SQL AVG() Syntax:
select avg(salary) from Sal
SUM() Function
The SUM() function
returns the total sum of a numeric column.
Syntax:
select sum(salary) from Sal
Top keyword
The SELECT TOP clause is
used to specify the number of records to return.
Syntax:
select top (1,2,..,n-1,n)(salary) from Sal
COUNT() Function
The COUNT() function
returns the number of rows that matches a specified criteria
Syntax:
select count(salary) from Sal
No comments:
Post a comment