MySQL POWER() Function

In MySQL, the POWER() function returns the value of the first argument raised to the power of the second argument. POWER() is the same as POW().

POWER() Syntax

Here is the syntax of MySQL POWER() function:

POWER(x, y)

Parameters

x
Required. The base.
y
Required. The exponent.

Return value

In MySQL, the POWER() function returns the value of the first argument raised to the power of the second argument.

The POWER() function will return NULL if any parameter is NULL.

POWER() Examples

SELECT
    POWER(2, 0),
    POWER(2, 2),
    POWER(2, 4),
    POWER(2.5, 2),
    POWER(2, -2),
    POWER(2, -4),
    POWER(2, NULL),
    POWER(NULL, 2),
    POWER(NULL, NULL)\G

output

*************************** 1\. row ***************************
      POWER(2, 0): 1
      POWER(2, 2): 4
      POWER(2, 4): 16
    POWER(2.5, 2): 6.25
     POWER(2, -2): 0.25
     POWER(2, -4): 0.0625
   POWER(2, NULL): NULL
   POWER(NULL, 2): NULL
POWER(NULL, NULL): NULL