Explain POWER() Function in SQL?

POWER() function :

This function in SQL Server is used to return a results after raising a specified exponent number to a specified base number. For example if the base is 5 and exponent is 2, this will return a result of 25.

Features :

  • This function is used to find a results after raising a specified exponent number to a specified base number.
  • This function accepts two parameters base and exponent.
  • The base value can be negative but not the exponent value.
  • The base and exponent value can be in fraction.
  • This function uses a formula
  • (base)
  • (exponent) = Returned value.

Syntax :

POWER(a, b)

Parameter :

This method accepts two parameters as given below :

  • a : Specified base number.
  • b : Specified exponent number.

Returns : It returns a results after raising a specified exponent number to a specified base number.

Example:

Getting a result of 49 for the base value 7 and exponent value 2.

SELECT POWER(7, 2);

Output :

49