Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

1 Answer
Maheshwari Thakur

Both pow() and power() are synonyms in MySQL. Following is the syntax −

select pow(yourValue1,yourValue2);
OR
select power(yourValue1,yourValue2);

Let us implement both the above syntaxes.

Using POW()

mysql> select POW(4,3);

This will produce the following output −

+----------+
| POW(4,3) |
+----------+
| 64       |
+----------+
1 row in set (0.00 sec)

Using POWER()

mysql> select POWER(4,3);

This will produce the following output −

+------------+
| POWER(4,3) |
+------------+
| 64         |
+------------+
1 row in set (0.00 sec)

Let us implement the above syntax in a table −

mysql> create table DemoTable
   (
   a int,
   n int
   );
Query OK, 0 rows affected (0.51 sec)

Insert some records in the table using insert command −

mysql> insert into DemoTable values(10,3);
Query OK, 1 row affected (0.18 sec)

Display all records from the table using select statement −

mysql> select * from DemoTable;

This will produce the following output −

+------+------+
| a    | n    |
+------+------+
| 10   | 3    |
+------+------+
1 row in set (0.00 sec)

Following is the query of POW() −

mysql> select POW(a,n) from DemoTable;

This will produce the following output −

+----------+
| POW(a,n) |
+----------+
| 1000     |
+----------+
1 row in set (0.02 sec)

Following is the query of POWER() −

mysql> select POWER(a,n) from DemoTable;

This will produce the following output −

+------------+
| POWER(a,n) |
+------------+
| 1000       |
+------------+
1 row in set (0.00 sec)

Advertisements

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.