A single row function returns a value based on a single row in a query, whereas an aggregate function returns a value based on all the rows in a query. These two types differ in the number of database rows on which they act. There are two general types of SQL functions: single row (or scalar) functions and aggregate functions.
SQL functions are used exclusively with SQL commands within SQL statements. If passed a null value, most functions return a null value. If passed an argument whose datatype differs from an expected datatype, most functions perform an implicit datatype conversion on the argument before execution. The SQL function format enables functions to operate with zero, one, or more arguments.įunction( argument1, argument2. SQL functions differ from SQL operators in the format in which they appear with their arguments. SQL functions are similar to SQL operators in that both manipulate data items and both return a result.