Mysql Power Function

MySQL: POWER Function

This tutorial explains how to use the MySQL POWER function with syntax and examples.

Description

The MySQL POWER function returns m raised to the nth power.

Syntax

The syntax for the MySQL POWER function is:

POWER( m, n )

Parameters or Arguments

m

Numeric value. It is the base used in the calculation.

n

Numeric value. It is the exponent used in the calculation.

Note

Applies To

The POWER function can be used in the following versions of MySQL:

  • MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0, MySQL 3.23

Example

Let's look at some MySQL POWER function examples and explore how to use the POWER function in MySQL.

For example:

mysql> SELECT POWER(6, 2);
Output: 36

mysql> SELECT POWER(6, -2);
Output: 0.027777777777777776

mysql> SELECT POWER(5.4, 3);
Output: 157.46400000000003

mysql> SELECT POWER(0, 3);
Output: 0

mysql> SELECT POWER(3, 0);
Output: 1