w3resource

MySQL POWER() function

POWER() function

MySQL POWER() returns the value of a number raised to the power of another number. The synonym of POWER() is POW().

This function is useful in -

  • POWER() is essential for modeling phenomena involving exponential growth or decay, such as compound interest, population growth, radioactive decay, and more.
  • POWER() is a key component in many scientific formulas, especially those that involve exponential relationships.
  • In finance, POWER() is crucial for calculating compound interest and determining future values of investments.
  • To compute the power of a signal the POWER() is fundamental in telecommunications, audio processing, image processing, and other fields where signal analysis is essential.
  • POWER() is utilized in probability and statistics for various calculations, including likelihood ratios, likelihood functions, and power functions in hypothesis testing.
  • In thermodynamics and heat transfer, POWER() is applied to model temperature distributions, heat transfer rates, and other phenomena involving exponential relationships.

Syntax:

POWER(M,N);

Arguments:

Name Description
M A number which is the base of the exponentiation.
N A number which is the exponent of the exponentiation.

Syntax Diagram:

MySQL POWER() Function - Syntax Diagram

MySQL Version: 8.0


Pictorial presentation of MySQL POWER() function

pictorial presentation of MySQL POWER() function

Example of MySQL POWER() function

Code:

SELECT POWER(3, 2);

Explanation:

The above MySQL statement returns the value of 32, i.e. 9.

Output:

mysql> SELECT POWER(3, 2);
+-------------+
| POWER(3, 2) |
+-------------+
|           9 | 
+-------------+
1 row in set (0.00 sec)

Example : POWER() function with negative value

Code:

SELECT POWER(4,-2);

Explanation:

The above MySQL statement returns the value of 4-2, i.e. 0.0625.

Output:

mysql> SELECT POWER(4,-2);
+-------------+
| POWER(4,-2) |
+-------------+
|      0.0625 | 
+-------------+
1 row in set (0.00 sec)

All Mathematical Functions

Previous: POW()
Next: RADIANS()



Follow us on Facebook and Twitter for latest update.