• September 30, 2014
  • SQL
  • Comments Off on SQL Functions

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.

Related Topics:

How to build java project using ant in eclipse?
JAXB marshalling – convert java object to xml example.
How to create pdf file in java using iText jar?
Generics class example.
OGNL in struts 2.
Hibernate One-to-One Mapping using xml.
Send inline image in email using JavaMail API.
Quartz 2 JobListener example.

 


Comments are closed.