Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

sql
communitycreator

What is the SQL server POWER() function?

Saad Akbar

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

The POWER function returns the result of a defined number raised to the power of a defined exponent number.

For example, the POWER() function will return the result of 2 raised to the power of 4, which is 16.

Syntax

POWER(a, b)

Parameters

  • a: the base number.
  • b: the exponent/power number.

Example

In this example, the POWER() function takes 8 as the base number and 2 as the exponent number. The function returns 64, as 8 raised to the power of 2 is 64.

SELECT POWER(8, 2);

Float values

Float values can also be passed in this function. The answer will also be returned as a float number.

SELECT POWER(3.5, 4.2);

Note: The base value can be negative, but the exponent value cannot be negative. Moreover, the base and exponent value can be passed as fractions.

RELATED TAGS

sql
communitycreator

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring