Get Cube of column in Postgresql

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

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

With an example for both

Get Cube in Postgresql:

POWER() function in posgresql gets the cube value

SELECT POWER(3,3) AS "Cube";

So the cube will be

Cube of column in postgresql 2

 

Get Cube of column in Postgresql table:

We use table student_details

Cube of column in postgresql 1


SELECT *,POWER(gradscore,3) AS cube_gradscore FROM student_detail;

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

So the resultant table will be

Cube 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.