totn MySQL Functions

MySQL: POW Function

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

Description

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

Syntax

The syntax for the POW function in MySQL is:

POW( 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 POW 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 POW function examples and explore how to use the POW function in MySQL.

For example:

mysql> SELECT POW(5, 2);
Result: 25

mysql> SELECT POW(5, -2);
Result: 0.04

mysql> SELECT POW(5.5, 3);
Result: 166.375

mysql> SELECT POW(0, 4);
Result: 0

mysql> SELECT POW(4, 0);
Result: 1