SQL Functions

Functions in SQL :

Functions are very powerful feature of SQL and can be used to do the followings:

  • Perform calculations on data.
  • Modify individual data items.
  • Manipulate output for group of rows
  • Format dates and number for display.
  • Convert column data types.

SQL functions sometimes takes arguments and return value. Functions are reusable programs.

Types of SQL Functions:

There are two types of SQL functions they are :

  1. Single Row Functions
    • Character function
    • Number function
    • Date function
    • Conversion function
    • General function
  2. Multiple Row Functions
    • Group Function

Single Row Functions : 

Single Row Functions are used to

  • manipulate data items
  • accept arguments and return one value.
  • act on each row that is returned.
  • it may modify the data type.
  • it can be nested.
  • it accept arguments that can be a column or expression.

Multiple Row Functions: 

Multiple Row Functions are also called as group function or aggregate functions.