In order to find raised to the power n in postgresql we use POWER() function. POWER() function in posgresql gets value raised to the power n. Let’s see how to
- Get value raised to the power n in postgresql
- Create the column which extracts the raised power of another column
With an example for both
Get value raised to the power n in postgresql:
POWER() function in posgresql gets the value raised to the power
SELECT POWER(3,2) AS "Square"; Select POWER(3,3) AS "Cube";
So the raised power 2 will be
Raised power 3 will be
Get raised power of column in Postgresql table:
We use table student_details
SELECT *,POWER(gradscore,4) AS power4_gradscore FROM student_detail;
We have created a column and stored power four of gradscore column.
So the resultant table will be