- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
To return value of a number raised to the power of another number, we should use ^ operator in MySQL?
No, ^ is the Bitwise XOR operator in MySQL. For this, use POW() or POWER() from MySQL. Let us first create a table &minuns;
mysql> create table DemoTable ( BaseValue int, PowerValue float ); Query OK, 0 rows affected (0.48 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable values(4,1.9867); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values(10,6.789); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable values(20,8.9); Query OK, 1 row affected (0.14 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output −
+-----------+------------+ | BaseValue | PowerValue | +-----------+------------+ | 4 | 1.9867 | | 10 | 6.789 | | 20 | 8.9 | +-----------+------------+ 3 rows in set (0.00 sec)
Following is the query to return the value of a number raised to the power of another number. Here, the Base Value and Power Value were inserted by us above −
mysql> select power(BaseValue,PowerValue) AS Result from DemoTable;
This will produce the following output −
+--------------------+ | Result | +--------------------+ | 15.707700779637127 | | 6151769.213414385 | | 379460404302.3042 | +--------------------+ 3 rows in set (0.00 sec)
- Related Articles
- In MySQL, how to raise a number to the power of another number?
- Number of digits in 2 raised to power n in C++
- In MySQL, how can we convert a value from one number system to the value in another number system?
- Return the result of the power to which the input value is raised with scimath in Python
- Return the result of the negative power to which the input value is raised with scimath in Python
- Return the result of the power to which the negative input value is raised with scimath in Python
- Why is any number raised to the power 0 always 1?
- Check if a number is a power of another number in C++
- Find last five digits of a given five digit number raised to power five in C++
- Calculating power of a number in MySQL?
- Minimum removals in a number to be divisible by 10 power raised to K in C++
- Find value of y mod (2 raised to power x) in C++
- How to return a string value version of the current number?
- How to return a number indicating the Unicode value of the character?
- How can we use MySQL SELECT statement to count number of rows in a table?

Advertisements