Get Square root of column in Postgresql

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

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

With an example for both

Get Square root in Postgresql:

SQRT() function in posgresql gets the square root value

SELECT SQRT(9) AS "Square Root";

So the square root will be

Square root of column in postgresql 2

 

Get Square root of column in Postgresql table:

We use table student_details

Square root of column in postgresql 1

SELECT *,SQRT(gradscore) AS squareroot_gradscore FROM student_detail;

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

So the resultant table will be,

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