7.10. Mathematical Functions and Operators
Functions and operators are essential for every application. You have already used some operators in this book but in this section you will find a complete list of mathematical functions. Operators related to geometric data types will not be discussed in this chapter.
Let's look at the mathematical operators first in Table 7.2.
Operator | Description | Example | Result |
---|---|---|---|
+ | Addition | SELECT 1+1; | 2 |
- | Subtraction | SELECT 14-3; | 11 |
* | Multiplication | SELECT 3*4; | 12 |
/ | Division | SELECT 18/3; | 6 |
% | Modulo | SELECT 14%3; | 2 |
^ | Exponentiation | SELECT 2^10; | 1024 |
|/ | Square root | SELECT |/ 361; | 19 |
||/ | Cube root | SELECT 5832; | 18 |
! | Factorial | SELECT 23!; | 862453760 |
!! | Factorial (prefix operator) | SELECT !! ... |
Get PHP and PostgreSQL: Advanced Web Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.