Pow Function In Sql in SQL
POW Function in SQL
The POW() function returns the value of a number raised to the power of another number.
Syntax:
POW(base, exponent)base— the number to be raised.exponent— the power to which the base is raised.
Example:
Calculate 2 raised to the power 3:
SELECT POW(2, 3) AS result;Result:
| result |
|---|
| 8 |
Notes:
POW()is supported in MySQL, PostgreSQL, SQL Server (asPOWER()), Oracle (asPOWER()).In SQL Server and Oracle, use
POWER()instead ofPOW().
Equivalent in SQL Server:
SELECT POWER(2, 3) AS result;Want examples with negative powers or fractional powers?