Other Mathematical Operators

Moderator: NorbertKrupa

Post Reply
User avatar
JimKnicely
Site Admin
Site Admin
Posts: 1825
Joined: Sat Jan 21, 2012 4:58 am
Contact:

Other Mathematical Operators

Post by JimKnicely » Thu Mar 14, 2013 12:23 pm

In addition to the usual mathematical operators such as +, -, / and *, Vertical offers a few useful extras!

Example:

Code: Select all

dbadmin=> SELECT 5!     factorial,
dbadmin->        5 // 2 integer_division,
dbadmin->        @ -25  absolute_value,
dbadmin->        2 ^ 3  exponentiation,
dbadmin->        |/ 25  squaure_root,
dbadmin->        ||/ 27 cube_root,
dbadmin->        '$$$'  root_of_all_evil;
factorial | integer_division | absolute_value | exponentiation | squaure_root | cube_root | root_of_all_evil
-----------+------------------+----------------+----------------+--------------+-----------+------------------
       120 |                2 |             25 |              8 |            5 |         3 | $$$
(1 row)
Have fun!
Jim Knicely

Image

Note: I work for Vertica. My views, opinions, and thoughts expressed here do not represent those of my employer.

Post Reply

Return to “Vertica Tips, Lessons and Examples”