Skip to main content

Getting the Root of a Number

  • April 22, 2018
  • 0 replies
  • 1 view

Forum|alt.badge.img+2

Jim Knicely authored this tip.

You can find the square root of a number with the |/ operator and the cube root of a number with the ||/ operator.

Example:

dbadmin=> SELECT |/25 square_root_of_25,
dbadmin->        ||/27 cube_root_of_27;
 square_root_of_25 | cube_root_of_27
-------------------+-----------------
                 5 |               3
(1 row)

Have fun!