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
Get Square root of column in Postgresql table:
We use table student_details
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,