Site icon

MySQL Functions


MySQL Functions can be invoked within expressions and returns a value that is used in place of the function call when the expression is evaluated.


The general the syntax for a MySQL Function call includes the function name followed by parenthesis
optional argument:

function_name(<arg1>[, <arg2>,…,<argn>])

Spaces around function arguments are permitted. However, by default there must be no white-space between a function name and the parenthesis following it. This helps the MySQL Parser distinguish between function calls and references to tables or columns that happen to have the same name as a function.

Functions in MySQL Expressions

A function call is a value expression, and can thus appear anywhere where a value expression is accepted. Columns are also perfectly fine to use as arguments as long as they are in the correct data type. A function’s output can also be the input to another MySQL function.

An expression that contains NULL always produces a NULL value unless otherwise indicated in the documentation for a particular function or operator. Mathematical functions will return NULL on error ( for example; division by zero)

mysql> SELECT 1/0;
| 1/0 |
| NULL |
1 row in set (0.00 sec)


The following are examples of simple functions within a SELECT statement:


The NOW function returns the current date/time.


The VERSION function returns the MySQL version currently being used on the database server host.


Numeric Functions

String Functions

Temporal Functions

MySQL Tutorials

MySQL Tutorials on this website:

For more information on MySQL Database:

Exit mobile version