Functions and Operators

Table of Contents

91. Non-Type-Specific Operators and Functions
Parentheses
Comparison Operators
Logical Operators
Control Flow Functions
92. String Functions
String Comparison Functions
Case-Sensitivity
93. Numeric Functions
Arithmetic Operations
Mathematical Functions
94. Date and Time Functions
95. Cast Functions
96. Other Functions
Bit Functions
Encryption Functions
Information Functions
Miscellaneous Functions
97. Functions and Modifiers for Use with GROUP BY Clauses
GROUP BY Functions
GROUP BY Modifiers
GROUP BY with Hidden Fields

A select_expression or where_definition in an SQL statement can consist of any expression using the functions described below.

An expression that contains NULL always produces a NULL value unless otherwise indicated in the documentation for the operators and functions involved in the expression.

Note: there must be no whitespace between a function name and the parentheses 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. Spaces around arguments are permitted, though.

You can force MySQL to accept spaces after the function name by starting mysqld with --ansi or using the CLIENT_IGNORE_SPACE to mysql_connect(), but in this case all function names will become reserved words. See ANSI mode.

For the sake of brevity, examples display the output from the mysql program in abbreviated form. So this:

mysql> SELECT MOD(29,9);
1 rows in set (0.00 sec)
+-----------+
| mod(29,9) |
+-----------+
|         2 |
+-----------+

is displayed like this:

mysql> SELECT MOD(29,9);
        -> 2