POWER()
nikolaspoczekaj19 total contributions
Published May 23, 2023
Contribute to Docs
The POWER()
function in SQL is a mathematical function that returns the value of a number raised to the power of another number. It is compatible with various SQL database systems such as MySQL, PostgreSQL, Oracle, and SQL Server.
Syntax
SELECT POWER(base, exponent)FROM table_name;
Example
In this example the following data is given in the table numbers
:
base_number | exp_number |
---|---|
3 | 2 |
5 | 3 |
7 | 0 |
The POWER()
function can be used to calculate the result:
SELECT base_number, exp_number, POWER(base_number, exp_number) AS power_numberFROM numbers;
The output will be:
base_number | exp_number | power_number |
---|---|---|
3 | 2 | 9 |
5 | 3 | 125 |
7 | 0 | 1 |
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.