The POWER SQL Function in MySQL and MariaDB - Power of exponent |
|
| POWER | Syntax: | POWER(Number, Exponent) | Return value: | FLOAT | Synonyms: | POW | Function type: | Numeric function | |
| | The POWER() function returns the value of "Number" raised to the power of "Exponent".
If either argument is NULL, the function POWER() returns NULL. | SQL Examples for the POWER function |
|
select power(2,4);
select power(2.1, 1.5);
select power(4, 0);
select power(4, -2);
select power(null, 4);
select power(4, null);
|
|
|
power(2.1, 1.5) |
double(23) |
3.043189116699782 |
|
|
|
power(4, -2) |
double(23) |
0.0625 |
|
|
power(null, 4) |
double(23) |
NULL |
|
|
power(4, null) |
double(23) |
NULL |
|
|
| The examples were created with the MyWAY SQL manager: | How to use the POWER() function in MySQL and MariaDB databases | The POWER() function in MySQL and MariaDB calculates the power of a given base raised to the specified exponent. The function is used when calculations with exponentiation have to be performed, for example compound interest calculations, growth rates or exponential models. The function uses floating point arithmetic, so the precision of the result depends on the underlying data type. | | Further MySQL und MariaDB SQL Numeric functions | |
| | More information about the POWER SQL function: and and |
|
|
|
|