MySQL POW() Function
In MySQL, the POW()
function returns the value of the first argument raised to the power of the second argument. POW()
is the same as POWER()
.
POW()
Syntax
Here is the syntax of MySQL POW()
function:
POW(x, y)
Parameters
x
- Required. The base.
y
- Required. The exponent.
Return value
In MySQL, the POW()
function returns the value of the first argument raised to the power of the second argument.
The POW()
function will return NULL
if any parameter is NULL
.
POW()
Examples
SELECT
POW(2, 0),
POW(2, 2),
POW(2, 4),
POW(2.5, 2),
POW(2, -2),
POW(2, -4),
POW(2, NULL),
POW(NULL, 2),
POW(NULL, NULL)\G
output
*************************** 1\. row ***************************
POW(2, 0): 1
POW(2, 2): 4
POW(2, 4): 16
POW(2.5, 2): 6.25
POW(2, -2): 0.25
POW(2, -4): 0.0625
POW(2, NULL): NULL
POW(NULL, 2): NULL
POW(NULL, NULL): NULL