SQL POWER() Function


The SQL POWER() is a function, and returns the value of X raised to the power of Y..

The SQL POWER() function returns the power of one number to another number.

The SQL POWER() function is supports only numeric column or an numeric field based expression.

It can be used in SELECT statement as well in where clause.


SQL POWER() Syntax

For MySql / Microsoft SQL SERVER


// For Input Number or Expression Value

SELECT POWER(X , Y);

Note:- The POWER() function returns a FLOAT value. Caution must be taken, however, with this function. The results will increase in size very quickly and can cause an overflow error.


SQL POWER() Example - Using Expression Or Formula

The following SQL SELECT statement returns the absolute value of a given input number or expression


SELECT POWER(2 , 3) AS 'Power Of 2 , 3';

Also we can write the above query in this way:


SELECT 2 * 2 * 2;

The result of above query is:

Power Of 2 , 3
8

SQL POWER() Function More Example

Input Value Result
POWER(2 , 2) 4
POWER(5 , 3) 125
POWER(-4 , 2) -16
POWER(2.2, 2) 4.8
POWER(-3.2 , 2) 10.2
POWER(5, -2) 0