SQL Functions

SQL provides no. of inbuilt functions which perform calculations on groups of rows and return one value for the whole group.

Commonly used SQL functions:

1. SQL AVG(): It is used to get the average value of a numeric column.
Syntax:

SELECT AVG(columnName) FROM tableName;

 

2. SQL COUNT(): It is used to get the number of rows that matches a specified criteria.
Syntax:

SELECT COUNT(columnName) FROM tableName;

 

3. SQL FIRST(): It is used to get the first value of the selected column.
Syntax:

SELECT FIRST(columnName) FROM tableName;

 

4. SQL LAST(): It is used to get the last value of the selected column.
Syntax:

SELECT LAST(columnName) FROM tableName;

 

5. SQL MAX(): It is used to get the largest value of the selected column.
Syntax:

SELECT MAX(columnName) FROM tableName;

 

6. SQL MIN(): It is used to get the smallest value of the selected column.
Syntax:

SELECT MIN(columnName) FROM tableName;

 

7. SQL SUM(): It is used to get the total sum of a numeric column.
Syntax:

SELECT SUM(columnName) FROM tableName;

 
Next Topic: Generics Tutorial with example.
Previous Topic: SQL CARTESIAN JOIN with example.

 

Please Share