SQL FUNCTIONS
• Perform calculations on data
• Modify individual data items
• Manipulate output for groups of rows
• Format dates and numbers for display
• Convert column datatypes
SQL functions may accept arguments and always return a value.
There are two distinct types of functions:
1) Single-row functions
Single-row functions are used to manipulate data items. They accept one or more arguments and return one value for each row returned by the query. An argument
can be one of the following:
• User-supplied constant
• Variable value
• Column name
• Expression
These functions operate on single rows only and return one result per row.
-Single row functions used in SELECT, WHERE and ORDER BY clauses.
-Single row functions can be nested.
There are different types of single-row functions.
- Character
- Number
- Date
- Conversion
- General
2) Multiple-row functions
-Multi-row SQL functions (also called group or aggregate functions) work upon group of rows and return one result for the complete set of rows. These functions ignore NULL values. The most commonly used multi-row SQL functions fall into the numeric group.
Ex - avg(),sum(),count(),etc..
Ex - avg(),sum(),count(),etc..