Get Cube root of column in Postgresql

In order to get cube root of column in postgresql we use CBRT() function. CBRT() function in posgresql gets the cube root of the column. Let’s see how to

  • Get cube root in postgresql
  • Create the column which extracts the cube root from another column

With an example for both

Get Cube root in Postgresql:

CBRT() function in posgresql gets the cube root value

SELECT CBRT(27) AS "Cube Root";

So the cube root will be

Cube root of column in postgresql 2

 

Get Cube root of column in Postgresql table:

We use table student_details

Cube root of column in postgresql 1

SELECT *,CBRT(gradscore) AS cuberoot_gradscore FROM student_detail;

We have created a column and stored cuberoot of gradscore column.

So the resultant table will be

Cube root of column in postgresql 3

 

                                                                                                 

Author

  • Sridhar Venkatachalam

    With close to 10 years on Experience in data science and machine learning Have extensively worked on programming languages like R, Python (Pandas), SAS, Pyspark.

    View all posts